Wednesday, August 25, 2010

Placing Javascript Statements inside HTML Documents

JavaScript programing statements (source code) made only be placed in certain locations within HTML documents. When a browser with a JavaScript interpreter reads the JavaScript code it can interpret and execute it so that some scripting task is completed. The simple document below shows JavaScript source code placed within HTML <SCRIPT></SCRIPT>

document.write("<P>Script tags can be placed ")
document.write("in the Head of an HTML document </P>")

<H1>The Script Tag: Example 1</H1>
<P>Script tags can also be placed in the Body of an HTML document.</P>

document.write("<P>Script tags will be ignored by ")
document.write("browsers that do not understand them.</P>")


No comments:

Post a Comment