First JavaScript - "Hello World!"
<< Introduction to JavaScript
<< JavaScript Tutorials - Herong's Tutorial Examples
This section provides the first JavaScript tutorial example - 'Hello World!'.
To show you how a simple JavaScript looks like, follow this tutorial to create our first JavaScript - "Hello World!".
1. Enter the following HTML document with one line of JavaScript:
<html> <head><title>Hello World!</title></head> <body> <script type="text/javascript"> document.write('Hello World!'); </script> </body> </html>
2. Save this HTML document as Hello_World.html.
3. Open Hello_World.html in Web browser. You will see:
Hello World!
Congratulations, you have created and executed your first JavaScript successfully!
Sections in This Chapter
What Is JavaScript?
Walking through the First JavaScript
The document.write() Method