EIW Stupid JavaScript Tricks


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.

Note: The events are specified in a <a> instead of the image, since some browsers don't support onClicl in the <img> tag.


User Selectable Background Color     demo     source

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


JavaScript Generated Back Hyperlink     demo     source

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


Layers (using DIV tags)     demo     source

Overlapping layers of a document, only one is displayed at a time.


Popup Window     demo     source

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


JavaScript Mortgage Calculator     demo     source

You can write interactive calculators using JavaScript.


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 objects document and navigator.


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.


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.


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.