Javascript rollover
PostPosted: Fri Jan 16, 2004 12:52 pm
OK, I was working on my site with the plan of putting some javascript image rollovers on it. This javascript was one that came with my HTML editor and goes like this:
<!-- START OF SCRIPT -->
<!-- For more scripts visit (URL omitted since the site's gone anyhow) -->
<SCRIPT LANGUAGE="JAVASCRIPT">
nav3=false;
/*If this is navigator 3*/
if((navigator.appName == "Netscape") && (navigator.appVersion.substring(0,1) >= "3"))
{
/*Set the flag*/
nav3=true;
/*prepare array of rollover images and click images*/
rollOver = new Array
/*LIST YOUR ROLLOVER IMAGES HERE*/
rollOver[0] = new Image(51,21)
rollOver[0].src="images/layout2_02unflash.gif"
rollOver[1] = new Image(51,21)
rollOver[1].src="images/layout2_02flash.gif"
/*******************************************************/
/* CEASE YOUR TAMPERING HERE! */
/*******************************************************/
}
/*If this is navigator 3, swaps image n on screen for image m in rollOver array*/
function rollSwitch(name,m)
{ if(nav3) { picSwap(name, rollOver[m]) }}
/*Swaps the image field in image object i1 for the image fields in image object i2. And vice versa*/
function picSwap(i1,i2){
var temp = i1.src
i1.src=i2.src
i2.src=temp}
// -->
</SCRIPT>
--------And here is how it was supposed to be activated in the webpage-----
<a href="jake"
onMouseOver="rollSwitch(document.hme,1)"
onMouseOut="rollSwitch(document.hme,0)" target="MainScreen">
<img src="images/layout2_02unflash.gif" border=0 NAME="hme"></a>
Now, assuming that my pics are indeed in the subdirectory /images/ and all files are layout02_*.gif (and that "jake" of course, is not really what goes there), can someone tell me why this script produces no effect at all in the page? (Not even an error) The whole layout consists of image slices within a table, and the cell in which the second part of the script went has a background image named layout02_2.gif.
Thanks!
<!-- START OF SCRIPT -->
<!-- For more scripts visit (URL omitted since the site's gone anyhow) -->
<SCRIPT LANGUAGE="JAVASCRIPT">
nav3=false;
/*If this is navigator 3*/
if((navigator.appName == "Netscape") && (navigator.appVersion.substring(0,1) >= "3"))
{
/*Set the flag*/
nav3=true;
/*prepare array of rollover images and click images*/
rollOver = new Array
/*LIST YOUR ROLLOVER IMAGES HERE*/
rollOver[0] = new Image(51,21)
rollOver[0].src="images/layout2_02unflash.gif"
rollOver[1] = new Image(51,21)
rollOver[1].src="images/layout2_02flash.gif"
/*******************************************************/
/* CEASE YOUR TAMPERING HERE! */
/*******************************************************/
}
/*If this is navigator 3, swaps image n on screen for image m in rollOver array*/
function rollSwitch(name,m)
{ if(nav3) { picSwap(name, rollOver[m]) }}
/*Swaps the image field in image object i1 for the image fields in image object i2. And vice versa*/
function picSwap(i1,i2){
var temp = i1.src
i1.src=i2.src
i2.src=temp}
// -->
</SCRIPT>
--------And here is how it was supposed to be activated in the webpage-----
<a href="jake"
onMouseOver="rollSwitch(document.hme,1)"
onMouseOut="rollSwitch(document.hme,0)" target="MainScreen">
<img src="images/layout2_02unflash.gif" border=0 NAME="hme"></a>
Now, assuming that my pics are indeed in the subdirectory /images/ and all files are layout02_*.gif (and that "jake" of course, is not really what goes there), can someone tell me why this script produces no effect at all in the page? (Not even an error) The whole layout consists of image slices within a table, and the cell in which the second part of the script went has a background image named layout02_2.gif.
Thanks!