bobrivers2003
Technical User
I have a image for a button in a form. When the image is clicked I want the image to change. I have it working if the image is displayed as
<img name="IMG1" id="IMG1" src="images/on.gif" onClick="swapImage();"
alt="Auto Refresh">
however if the image in the form is displayed as
<input type="image" name="IMG1" id="IMG1" src="images/on.gif"
onClick="swapImage();" alt="Auto Refresh">
it wont work. I'm not sure how to send the js to <input type ="image" ... instead of <img src="....
The javascript:
intImage = 2;
function swapImage() {
switch (intImage) {
case 1:
form.IMG1.src = "images/on.gif"
intImage = 2
return(false);
case 2:
form.IMG1.src = "images/off.gif"
intImage = 1
return(false);
}
}
The form:
<form id="form" method="get">
<img name="IMG1" id="IMG1" src="images/on.gif" onClick="swapImage();"
alt="Auto Refresh">
</form>
Any help would be greatly appreciated
<img name="IMG1" id="IMG1" src="images/on.gif" onClick="swapImage();"
alt="Auto Refresh">
however if the image in the form is displayed as
<input type="image" name="IMG1" id="IMG1" src="images/on.gif"
onClick="swapImage();" alt="Auto Refresh">
it wont work. I'm not sure how to send the js to <input type ="image" ... instead of <img src="....
The javascript:
intImage = 2;
function swapImage() {
switch (intImage) {
case 1:
form.IMG1.src = "images/on.gif"
intImage = 2
return(false);
case 2:
form.IMG1.src = "images/off.gif"
intImage = 1
return(false);
}
}
The form:
<form id="form" method="get">
<img name="IMG1" id="IMG1" src="images/on.gif" onClick="swapImage();"
alt="Auto Refresh">
</form>
Any help would be greatly appreciated