HTML and CSS Reference
In-Depth Information
2
Unlike Perl and Python scripts, JavaScript scripts are not stand-alone programs. They
are run in the context of an HTML document. When programming on the client side,
the first step will be to create an HTML document in your favorite text editor, such as
UNIX vi or emacs, or Windows Notepad,
1
WordPad, or TextPad (see Figure 2.1). There
are a number of popular integrated development environments (IDEs) such as NetBeans,
Komodo Edit, and Eclipse, with highlighting, validation, debugging features, and so on
you might prefer to use. A list of recommended IDEs can be found at
http://JavaScript-
ide.software.informer.com/downloads/.
Because the file you create is an HTML document,
its name must include either an
.html
or
.htm
extension. JavaScript programs can be
embedded within the HTML document between the
<script>
and
</script>
tags.
Figures 2.1 and 2.2 show an HTML file containing JavaScript code.
Figure 2.1
JavaScript in TextPad editor.
1. If you are using Windows Notepad, be sure to turn off word wrap (under the Format menu) to avoid
errors in your program.
29