ADD A SCRIPT BLOCK TO YOUR HTML PAGE
A script block includes an opening script tag, a closing script tag, and everything in between.
A script block can be used in the head or the body
of an HTML or XHTML page. A script block is often used in the head section to
declare variables and functions (reusable groups of
code statements).
A script element can include two attributes:
language and type. The type attribute
refers to the MIME type, and is required for valid code. The
language attribute is optional, but is useful for older browsers
that don't recognize the type attribute. The
language attribute can also be used to specify a particular
version of JavaScript.
MIME (Multipurpose Internet Mail Extension) types include text, graphic, audio, and video files. MIME formats allow both text and nontext information to be sent over the Internet.
To include a script block in the head of your page:
<head> <title>My JavaScript Page</title> <script type="text/javascript" language="JavaScript"> <!-- insert the script here // --> </script> </head>
The comment tags are used to hide the script from older browsers that don't support JavaScript; otherwise, older browsers may print the contents of the script block to the page even though they don't execute the script.
To insert a script block in the body of your page, the format is basically the same:
<body> <script type="text/javascript" language="JavaScript"> <!-- insert the script here // --> </script> </body>
