free website & web store builder from

How to be an effective web developer

How two simple exercises changed my life

free website & web store builder from

JavaScript within HTML

JavaScript statements are embedded within an HTML document and are interpreted by a Web browser. Unlike programming in Java, a programmer does not programme with JavaScript by preparing source code and compiling it to produce executable code. JavaScript is directly executed by the Web browser. The most general form of JavaScript used in HTML documents is to include JavaScript statements within <SCRIPT> and </SCRIPT> tags. Each JavaScript statement is written on a separate line. If a statement is in some way incorrect, the browser (and its builtin JavaScript interpreter) may report an error, or it may stop executing the erroneous JavaScript and do nothing. Let us examine a simple HTML4.0 document that does nothing that could not be done with HTML alone. All that it does is have the document include the italicised text "Welcome to programming with JavaScript!"

Most of the document is normal HTML. There are two new tags -
<SCRIPT> to indicate the start of JavaScript code, and
</SCRIPT> to indicate its end. The only line of JavaScript is the one containing:
("<em>Welcome to programming with JavaScript!</em>")