JasonBleers
Technical User
Here's Javascipt my code:
<!--
/* Inactive images */
img1on = new Image();
img1on.src = "files/image1on.gif";
img2on = new Image();
img2on.src = "files/image2on.gif";
img3on = new Image();
img3on.src = "files/image3on.gif";
img4on = new Image();
img4on.src = "files/image4on.gif";
img5on = new Image();
img5on.src = "files/image5on.gif";
img6on = new Image();
img6on.src = "files/image6on.gif";
/* Active images */
img1off = new Image();
img1off.src = "files/image1off.gif";
img2off = new Image();
img2off.src = "files/image2off.gif";
img3off = new Image();
img3off.src = "files/image3off.gif";
img4off = new Image();
img4off.src = "files/image4off.gif";
img5off = new Image();
img5off.src = "files/image5off.gif";
img6off = new Image();
img6off.src = "files/image6off.gif";
/* Image On function */
function imgOn(imgonName) {
if (document.images) {
document
.src = eval(imgonName + "on.src"
}
}
/* Image Off function */
function imgOff(imgoffName) {
if (document.images) {
document
.src = eval(imgoffName + "off.src"
}
}
/* All Images Off function */
function allOff() {
if (document.images) {
for(i=1; i<6; i++) {
tempImg = eval("img" + i);
document[tempImg].src = eval(tempImg + "off.src"
}
}
}
//-->
The following link works fine:
<!--
<A href="?" onmouseout="imgOff('img1');" onmouseover="imgOn('img1')"><IMG alt="" border=0 height=28 name="img1" src="files/image1off.gif" width=106></A>
-->
The following link doesn't:
<!--
<A href="?" onmouseout="imgOff('img1');" onmouseover="allOff()"><IMG alt="" border=0 height=28 name="img1" src="files/image1off.gif" width=106></A>
-->
Whenever the allOff function is called I recieve and error stating that 'img1 is not defined'. Can anybody tell me why?
I really need a function that returns all the images to the off state. Your help is much appreciated.
<!--
/* Inactive images */
img1on = new Image();
img1on.src = "files/image1on.gif";
img2on = new Image();
img2on.src = "files/image2on.gif";
img3on = new Image();
img3on.src = "files/image3on.gif";
img4on = new Image();
img4on.src = "files/image4on.gif";
img5on = new Image();
img5on.src = "files/image5on.gif";
img6on = new Image();
img6on.src = "files/image6on.gif";
/* Active images */
img1off = new Image();
img1off.src = "files/image1off.gif";
img2off = new Image();
img2off.src = "files/image2off.gif";
img3off = new Image();
img3off.src = "files/image3off.gif";
img4off = new Image();
img4off.src = "files/image4off.gif";
img5off = new Image();
img5off.src = "files/image5off.gif";
img6off = new Image();
img6off.src = "files/image6off.gif";
/* Image On function */
function imgOn(imgonName) {
if (document.images) {
document
}
}
/* Image Off function */
function imgOff(imgoffName) {
if (document.images) {
document
}
}
/* All Images Off function */
function allOff() {
if (document.images) {
for(i=1; i<6; i++) {
tempImg = eval("img" + i);
document[tempImg].src = eval(tempImg + "off.src"
}
}
}
//-->
The following link works fine:
<!--
<A href="?" onmouseout="imgOff('img1');" onmouseover="imgOn('img1')"><IMG alt="" border=0 height=28 name="img1" src="files/image1off.gif" width=106></A>
-->
The following link doesn't:
<!--
<A href="?" onmouseout="imgOff('img1');" onmouseover="allOff()"><IMG alt="" border=0 height=28 name="img1" src="files/image1off.gif" width=106></A>
-->
Whenever the allOff function is called I recieve and error stating that 'img1 is not defined'. Can anybody tell me why?
I really need a function that returns all the images to the off state. Your help is much appreciated.