felixtkatt
Programmer
I'm trying to create a simple image swap onMouseOver and onMouseOut. The only twist is that the image I want to swap is the submit button on a form. I assume I have to link the input tag itself (because the onMouseOver method belongs to the anchor tag) but I can't get the src parameter to change in the input tag. Here is the code I have:
<script language="JavaScript">
<!--
newButtonOn = new Image();
newButtonOn.src = "newOn.gif";
newButtonOff = new Image();
newButtonOff.src = "newOff.gif";
function imgOn() {
document.Form1.newButton.src = newButtonOn.src;
}
function imgOff() {
document.Form1.newButton.src = newButtonOff.src;
}
//-->
</script>
In the page is the following code.
<form action="newmail.cfm" method="post" target="__blank" name="Form1">
<a href="" onMouseOver="imgOn()" onMouseOut="imgOff()">
<input type="image" src="newOff.gif" alt="Compose New" name="newButton" value="submit">
</a>
</form>
Is this illegal? Is there another way to do this that I am just not seeing? Someone please help me! FTK
<script language="JavaScript">
<!--
newButtonOn = new Image();
newButtonOn.src = "newOn.gif";
newButtonOff = new Image();
newButtonOff.src = "newOff.gif";
function imgOn() {
document.Form1.newButton.src = newButtonOn.src;
}
function imgOff() {
document.Form1.newButton.src = newButtonOff.src;
}
//-->
</script>
In the page is the following code.
<form action="newmail.cfm" method="post" target="__blank" name="Form1">
<a href="" onMouseOver="imgOn()" onMouseOut="imgOff()">
<input type="image" src="newOff.gif" alt="Compose New" name="newButton" value="submit">
</a>
</form>
Is this illegal? Is there another way to do this that I am just not seeing? Someone please help me! FTK