According to Security Space (April, 2007),
Gecko, the engine used in more recent versions of Netscape Navigator,
does not support the layer functions
that were available in some earlier versions of Navigator.
(sometimes referred to as JScript),
Microsoft Internet Explorer also supports another scripting language
which uses a subset of Visual Basic.
A passage of script in an HTML file
is introduced with the script tag
and terminated with the /script tag.
the statements within the script are normally commented out
with <!-- and -->.
in an HTML file is
// can be used to comment out the rest of a line,
as in the second-last line above.
The noscript and /noscript tags
can be used mark text that will be included
only if the required scripting language or languages
are not enabled;
is just to have it insert bits of content
into a page when the page is rendered.
This can be done with the write
or writeln method
of the document object.
The parameters of these methods
can be any series of expressions or properties
whose values you want displayed.
the following code is supposed to tell the user
what browser type they are using:
document.writeln('you are using ', navigator.appName, '.')
That is how this page can tell you that
Browsers can lie about their identity, however,
and often do.
Literal strings can be enclosed
either in single quotes (as above)
or in double quotes.
The dot notation is used for properties of objects
(as in the example above).
It is also employed for methods
(functions associated with a particular type of object).
For scripting of any complexity,
you need to make use of variables.
Variables are fairly simple objects
that are assigned values with the = operator.
the following code creates a new Date object
for today's date,
assigns it to the variable today,
and then uses the Date object's getDay() method
to display the day of the week
as a number
(where Sunday is 0, Monday is 1, and so on.)
An array object can be used to contain a list,
an individual item of which can be referenced
by appending a numeric expression in square brackets to the
the following code creates a new array
containing the names of the days of the week
and uses it to display the name of the day of the week today.
With the exception of Internet Explorer, however,
they do generally provide optional consoles
that display scripting errors.
from the "Web Development" submenu
of the "Tools" menu;
directly from the "Tools" menu;
from the "Advanced..." submenu
of the "Tools" menu.
In Internet Explorer,
the procedure to see errors is a little more roundabout
and the results a bit more limited:
load a page that causes an error,
double click on the exclamation-triangle symbol
at the bottom left (in the status bar),
check "Always display this message
when a page contains errors",
click on "Show Details >>",
click on "OK".
For More Information
There are many references
though none appears to be truly comprehensive.
A selection follows.
(Sample scripts and tutorials.)