I am trying to code some simple function. As a test I have written the following: (sorry, I don't know how to format on this page)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Examples of Strings</title>
<script type="text/javascript">
//<![CDATA[
<!-- hide me
// get a name
// declarations
var int firstVariable = 7;
var int firstVariable = 9;
// stop hiding me -->
//]]>
</script>
</head>
<body>
<h1>My First Function</h1>
<script type="text/javascript">
//<![CDATA[
<!-- hide me
function name(firstVariable, secondVariable){
int result = firstVariable + secondVariable;
document.writeln(result);
return result;
}
// show me -->
//]]>
</script>
</body>
</html>
The validator http://validator.w3.org/check says it's perfectly fine. HOWEVER, under no circumstances can I get the function to work. Am I doing something fundamentally wrong in relation to the Document Object Model?