Netprog 2000 - Stupid JavaScript Tricks


These aren't all supid tricks - some are actually useful...

User Selectable Background Color

background.html Event handlers (in this case button onCLick handlers) can change the document background color.


Active Bullets

activebullet.html You can use images as linked bullets and have the image change when the user moves the mouse over the image. The general idea is to use the onMouseOver and onMouseOut events to switch the SRC attribute of an image.


Netscape Layers

layers.html Netscape supports HTML layers (IE does not!). You can turn on an off individual layers in response to user actions.


Move the Browser

windowjump.html You can use the navigator object to alter browser attributes include the window size and the position of the browser on your screen. The example works with both IE and Netscape, although IE doesn't seem to let JavaScript change the window size.


Moving Cookie Game

cookie.html
(uses Netscape Layers)
A complete game (OK, a simple silly game) written in JavaScript. This script uses:
  • the JavaScript function setTimeout to schedule a subroutine call a short time in the future.
  • Button event handlers
  • Text Input event handlers
  • Netscape Layers - to move an image around in the browser window (so it only works with Netscape).

Popup Window

popup.html How to use JavaScript to create those annoying popup windows containing advertisements.

Object Property Lists

props.html Using javascript you can access and alter object properties, including some properties of the document. The example here generates a list of all the properties of the object document.


Using a SELECT as a Menu

select.html You can turn a SELECT form element in to a menu. Once the user selects a new menu item - the browser takes action immediately (it's not necessary for the user to press a "go" or "submit" button). The example includes two selects, one changes a form field value and the other jumps to another JavaScript demo.


JavaScript Generated BACK hyperlink

backbutton.html An example of using JavaScript to generate a document footer including a BACK hyperlink.

JavaScript Mortgage Calculator

calc.html You can write interactive calculators using JavaScript.