Advanced Web Publishing X52.9749
JavaScript: March 15, 1998
Bibliography
- JavaScript documentation for
Netscape
Navigator and
Microsoft
Internet Explorer.
- The World Wide Web Consortium documentation for
scripts
in HTML files.
- The O'Reilly JavaScript
book.
- Andrew Wooldridge's
JavaScript Index
contains examples such as this
calculator
and Stefan Koch's
tutorial.
- The JavaScript
newsgroup.
The <SCRIPT> tags
<SCRIPT> JavaScript is the default.
<SCRIPT LANGUAGE = "JavaScript"> Deprecated by the WWW Consortium.
<SCRIPT TYPE = "text/javascript"> How the Consortium wants it.
JavaScript Examples
- The
document
object and its
write
method.
- More elaborate
arguments
for the write method.
- Display the
properties
of various objects.
- You can
change
some of the properties of an object.
- Create a
new
object and store it in a variable.
- A
variable
can contain a number or string instead of an object.
- Pop up a
dialog box:
confirm, prompt,
alert.
- The
if
statement does one of several alternatives.
- An
exercise
in which you have to write an if statement.
- Loops
do the same thing over and over.
- Use a loop to mass produce
buttons.
- Send a
cookie
to a client to remember his or her preferences.
Do not run this example until we discuss it in class.
- Package statements into a
function.
- A form that runs a
gateway.
(The gateway is a
Perl
program.)
- A form that runs the JavaScript onClick and onChange
event handlers
before it runs its gateway.
- Exercise.
Make the above form display an
alert
message if more than 20 slices have
been ordered.
Simply put an
if
statement in the
compute
function.
Better yet, instead of displaying an alert message, you can travel
to a new URL by changing the value of the property
window.location