To get closeWindow() to work on IE as well as FF, you can check whether the global object 'netscape' has been defined before referencing it (to avoid a runtime error). The function does work in FF8,...
The JSON object is part of ECMAScript 5. For the sake of older browsers, you might want to test whether this object is present, and if it isn't use the public-domain json2.js module available at...
The problem is that in JavaScript (unlike C or Java), just because the operands of the / operator are both integers, doesn't mean that the value returned will be an integer. Rather,...
When a JavaScript URL returns a value, the browser displays that value. You need to add the 'void' operator so that the expression is evaluated for its side effect, but only 'undefined' is returned,...
By default, a cookie is accessible to the web page that created it and any other web page in the same directory, or in a subdirectory of that directory. To make a cookie visible to any web page in...
I guess I was assuming that leoghost's script could be rewritten to use a global function rather than element methods. Sadly, we can't just add a getElementsByClassName() implementation to...
xelawho's solution looks good. Additionally, if you want to prevent overwriting an already existing document.getElementsByClassName() method, you could do something like:
Just put it in a <script> element in the HEAD. BTW, an alternative way to preload an image that you'll see a lot is to use the Image() constructor, so the following two lines of JavaScript are...
The "var img; ... window.onload..." code is where the global variable 'img' gets declared and initialized. You can see 'img' used later in the 'onmouseover' and 'onmouseout' code.
Maybe assigning the PDF file to an image node's src property doesn't load and cache the file because it's in PDF format, not a standard graphics format like JPG, GIF, or PNG. I'm curious how you are...
Don't forget to preload the images. Once you've shown the images in your own browser, they'll be cached and will display fast, so it's easy to forget that the first time other users hover over a link...
Hi Mikethepainter,
Looks like you're getting there! Just a few comments. First, you seem to have some extraneous code, such as the duplicated image (same ID and everything -- just delete one of...