I was trying to use event.preventDefault in a function called by an onclick method of an anchor tag. Although this worked fine in Firefox and chrome, naturally, I.E. would find it necessary to treat this differently. IE 8 sadly does not support event.preventDefault() (I.E. 9 however, does add support for preventDefault). However, this can easily be gotten around by using a simple test:
(event.preventDefault) ? event.preventDefault() : event.returnValue = false;
This will check if preventDefault is defined, and if not, it will use IE’s event.returnValue instead. As far as I can tell, event.returnValue=false will achieve the same goal in most cases.