Advanced Web Publishing X52.9749

JavaScript: March 15, 1998

Bibliography

  1. JavaScript documentation for Netscape Navigator and Microsoft Internet Explorer.
  2. The World Wide Web Consortium documentation for scripts in HTML files.
  3. The O'Reilly JavaScript book.
  4. Andrew Wooldridge's JavaScript Index contains examples such as this calculator and Stefan Koch's tutorial.
  5. 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

  1. The document object and its write method.
  2. More elaborate arguments for the write method.
  3. Display the properties of various objects.
  4. You can change some of the properties of an object.
  5. Create a new object and store it in a variable.
  6. A variable can contain a number or string instead of an object.
  7. Pop up a dialog box: confirm, prompt, alert.
  8. The if statement does one of several alternatives.
  9. An exercise in which you have to write an if statement.
  10. Loops do the same thing over and over.
  11. Use a loop to mass produce buttons.
  12. Send a cookie to a client to remember his or her preferences. Do not run this example until we discuss it in class.
  13. Package statements into a function.
  14. A form that runs a gateway. (The gateway is a Perl program.)
  15. A form that runs the JavaScript onClick and onChange event handlers before it runs its gateway.
  16. 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