A Simple JavaScript Example

From Techotopia
Revision as of 15:23, 9 April 2007 by Neil (Talk | contribs) (New page: No programming book would be complete without an initial example application just to get the reader started, and this book is no exception. In addition to a quick confidence boost for the ...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

No programming book would be complete without an initial example application just to get the reader started, and this book is no exception. In addition to a quick confidence boost for the novice this serves as a good opportunity to check that the environment being used in for the rest of this book is fully functional.

Ever since the the first book on programming for the C language was published it has become traditional that the first example consists of writing code to display the words "Hello World". With this tradition in mind we will begin with such as example.

Using your favorite editor create an HTML file with the following content:

<html>
<head>
<title>My First JavaScript Example
</head>
<body>
<script>
document.writeln( "Hello World" );
</script>
</body>