Forum Moderators: open
The rollover works but it'll show the ordinary submit button as well!
I could set the input to "hidden" for the ordinary one but then if i do that, it won't proceed if I just hit Enter. I have to click on the image submit button!
This is the code I'm using for the rollover submit button...
[idocs.com...]
Why not use an ordinary roll on - roll off script and attach it to the <input type="image">-button?
but_on = new Image(); but_off = new Image();
but_on.src = "but_on.png";
but_off.src = "but_off.png";
function togglepix(pic, t) {
if (document.getElementById) {
document.getElementById(pic).src = (t? but_on.src : but_off.src);
}
}/-/-/-/-/-/-/-/-/-/-/-/
<input type="image" src="but_off.png" id="mybutton"
onmouseover="togglepix(\'mybutton\', 1); return true"
onmouseout="togglepix(\'mybutton\', 0); return true">
Where does the first code go? I add it with <SCRIPT TYPE="text/javascript"> right?
This is what I did..
<SCRIPT TYPE="text/javascript">
<!--
but_on = new Image(); but_off = new Image();
but_on.src = "login_on.jpg";
but_off.src = "login.jpg";
function togglepix(pic, t) {
if (document.getElementById) {
document.getElementById(pic).src = (t? but_on.src : but_off.src);
}
//-->
</SCRIPT>
<input type="image" onSubmit="this.form.action.value='login'" name="Login" value="Login" src="login_on.jpg" id="mybutton"
onmouseover="togglepix(\'mybutton\', 1); return true"
onmouseout="togglepix(\'mybutton\', 0); return true">
I get an error though.
The backward slashes in the togglepix function are very wrong. Try
togglepix('mybutton', 1);
and
togglepix('mybutton', 0);
Another thing is that there have to be 2 closing brackets in the script: one to close the function, and one to close the if-statement. So it should end like this:
document.getElementById(pic).src = (t? but_on.src : but_off.src);
}
}
//-->
</SCRIPT>