Mitzrah's Get IT Right Column!! Making Link Plates - Section 2 Updated : Friday, August 07, 1998 |
![]() |
This tutorial will help you set up cool on/off buttons like the one I use for my navbar. What happens is that if you hover above my navbar buttons the image will change to a different one! Too bad this nifty thing doesn't want to work on Internet Explorer 3. So they are missing out on a lot! In this tutorial we have 3 buttons as an example. You can always put more buttons in if you like to, explained later.
<script LANGUAGE="Javascript">
<!--
browserVer = parseInt(navigator.appVersion);
browserName = navigator.appName;
if (browserVer >= 4) {
version = "v4";
}
else {
if (browserName == "Netscape" && browserVer >=3) {
version = "v4";
}
else {
version = "v3";
}
}
if (version == "v4") {
button1on = new Image();
button1on.src = "button1_on.jpg";
button2on = new Image();
button2on.src = "button2_on.jpg";
button3on = new Image();
button3on.src = "button3_on.jpg";
button1off = new Image();
button1off.src = "button1_off.jpg";
button2off = new Image();
button2off.src = "button3_off.jpg";
button3off = new Image();
button3off.src = "button3_off.jpg";
}
function img_on(imgName) {
if (version == "v4") {
imgOn = eval(imgName + "on.src");
document [imgName].src = imgOn;
}
}
function img_off(imgName) {
if (version == "v4") {
imgOff = eval(imgName + "off.src");
document [imgName].src = imgOff;
}
}
//-->
</script>
</head>
NOTES on JAVAscript:
Your links will then have to adopt this format:
<p>
<a HREF onMouseOver="img_on('button1');window.status='status
bar message here';
return true" onMouseOut="img_off('button1');window.status=''">
<img SRC="button1_off.jpg"
NAME="button1" WIDTH HEIGHT BORDER="0"
ALT="Alternative message for graphic here"></a><br>
<a HREF onMouseOver="img_on('button2');window.status='status
bar message here';
return true" onMouseOut="img_off('button2');window.status=''">
<img SRC="button2_off.jpg"
NAME="button2" WIDTH HEIGHT BORDER="0"
ALT="Alternative message for graphic here"></a><br>
<a HREF onMouseOver="img_on('button3');window.status='status
bar message here';
return true" onMouseOut="img_off('button3');window.status=''">
<img SRC="button3_off.jpg"
NAME="button3" WIDTH HEIGHT BORDER="0"
ALT="Alternative message for graphic here"></a><br>
</p>
The HTML codes:
HINTS & TIPS:
Notes from Alex:
If you found my tutorial helpful, please drop a note by my guestbook! So I know that you have dropped by and benefitted from my efforts, it took me quite sometime to get these tutorial up! Click on home and then SIGN GUESTBOOK! I will also visit your homepage at GeoCities and sign your guestbook if you sign mine!
|
||
[ Emiri Nakayama
| Sailor Mars, Rei | About Me | Photo Gallery ] |
![]() |
![]() |
LinkExchange Member | Free Home Pages at GeoCities |