The SCRIPT tag
One technique for calling functions is to embed them inside an anchor link: Show Me An Alert!. A browser will try to open any clicked href link and load the page it represents. The alert function allows us to remain on the same page and not load a new one because the alert function returns a null value. The browser sees this null and stops, knowing that there is nothing to be loaded. The Void function's purpose is to return null, without doing anything else, thus cancelling the page load. Void must be called with a parameter.
Alternative to Void
Void can sometimes cause errors. One alternative is to use an href that points to "#", a non-existent url, and call your code in the 'onclick' event of that hyperlink. This can be problematic, though because many browsers will search the page for the "#" anchor link, and reload, or jump to the top of the site page. You can prevent the browser from evaluating the hyperlink altogether, by ending your onclick code with the statement 'return false'. The previous example, using this technique, would look like this: New Window
- photo_camera Keyboard image by S.Q T from Fotolia.com