Magic Buttons Upgrade

If your Magic Buttons were working fine with Netscape 3.0 and are not working with Netscape 4 (Communicator), then this upgrade is for you.

The main difference is in the browser test. Where we were looking for Netscape version 3, we will now look for Netscape version 3 and up. There are a couple other changes too, but they are simple and all within the <SCRIPT> tags in the document <HEAD>.

First change this...

// browser test:
agent = navigator.userAgent
browserVer = 2
if (agent.indexOf("a/3",6) == -1) {browserVer = 2}
else {browserVer = 1}

To this...

// browser test:
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
if (browserName == "Netscape" && browserVer >= 3) version = "1";
else version = "2";


Then change this...

// preload images:
if (browserVer == 1) {

To this...

// preload images:
if (version == "1") {


And lastly, change this...

if (browserVer == 1) {
document.images[imgDocID].src = eval(imgObjName + ".src")

To this...

if (version == "1") {
document.images[imgDocID].src = eval(imgObjName + ".src")


And that's it!

Explorer users are still SOL, sorry to say (well, not that sorry).

To start of Magic Buttons Tutorial


PROFESSIONAL WEB DESIGN