J
John
I´m trying to find out how to switch between an image by a mouseclick.
The function should check if the image is on or off but it doesn´t work.
What´s wrong?
Below the script.
start_on = new Image;
start_on.src = "images/start_on.jpg";
start_off = new Image;
start_off.src = "images/start_off.jpg";
function switch(image) {
document.images[image].src = (document.images[image].src.indexOf("_off")==-1)? eval(image + "_off.src"); eval(image + "_on.src")
}
<img border="0" name="start" src="images/start_on.jpg" onClick="switch('start')">
Thanks
John
http://members.home.nl/jpeskens
The function should check if the image is on or off but it doesn´t work.
What´s wrong?
Below the script.
start_on = new Image;
start_on.src = "images/start_on.jpg";
start_off = new Image;
start_off.src = "images/start_off.jpg";
function switch(image) {
document.images[image].src = (document.images[image].src.indexOf("_off")==-1)? eval(image + "_off.src"); eval(image + "_on.src")
}
<img border="0" name="start" src="images/start_on.jpg" onClick="switch('start')">
Thanks
John
http://members.home.nl/jpeskens