EIW 2000 - Stupid JavaScript Tricks


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

User Selectable Background Color     demo     source

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


Active Bullets (Mouseover Images)     demo     source

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     demo     source

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


DIVS instead of Layers (works on both IE and Netscape).     demo     source

Same idea as the layers demo, but this one uses DIV tags and includes JavaScript that will work for either Netscape or IE.


Move the Browser     demo     source

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     demo     source

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
  • a DIV - to move an image around in the browser window.


Popup Window     demo     source

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


JavaScript Object Property Lists     demo     source

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     demo     source

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     demo     source

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


JavaScript Mortgage Calculator     demo     source

You can write interactive calculators using JavaScript.


Rubber Window     demo     source

You can try to change the window size, but it keeps coming, and coming, and ...