I have this script in a separate Sample.js file:
function MyPrint(text)
{
document.write(text);
}
And I have the following HTML page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Silly example</title>
</head>
<body>
<div>
<script type="text/javascript" src="JavaScript/Sample.js">
MyPrint("Hello silly world!");
</script>
</div>
</body>
</html>
The end result is that the text "Hello, stupid world!" NOT printed on the page. What should I do to make this work? I would prefer not to move the script tag to the head if possible. Thank you
Boris source
share