Starting JavaScript
Embedding Script
Javascript statements are hidden in HTML comments to prevent incorrect interpretation by older browsers that do not recognize JAVA script. An example HTML document with embedded JAVA script is shown.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>An Example of JavaScript code</title>
<head>
<body>
<script language="JavaScript">
<!-- Use the HTML comment to hide JavaScript from old browsers
document.write("This text was written using JavaScript.")
// End hiding JavaScript -->
</script>
<NOSCRIPT>
You see this if your browser won't run JavaScript.
</NOSCRIPT>
</body>
</html>
Note that there are two tags used to implement this script example:
- SCRIPT - The area between the <SCRIPT> and the </SCRIPT> tags defines the script program.
- NOSCRIPT - The area between the <NOSCRIPT> and the </NOSCRIPT> tag is run by browsers that can't run JAVA script or have the feature turned off.
|