PDA

View Full Version : Can a Submit "image" button be made into a RollOver



skeatt
Dec 5th, 2002, 06:43 AM
It took a bit of searching the forum to figure out how to make a Submit button an image...I ended up making this..

<input type="image" name="submit" value="Submit" alt="Submit Form" src="image9off.gif" width="45" height="26">

But it doesn't match my other buttons that have rollOver effect, so can you make an Image submit a rollOver?

This is what I've used on my other images...
<a href="education.html" target="_self" onclick="go('education.html');return false;"
onMouseOver="imageSwap('imgOn','img4','img4')"
onMouseOut="imageSwap('imgOff','img4','img4')"
onMouseDown="imageSwap('imgDn','img4','img4')"
onMouseUp="imageSwap('imgOn','img4','img4')">
<img name="img4" src="images_nav/image4off.gif" border="0" width="110" height="40"></a></td>

glenngv
Dec 5th, 2002, 07:18 AM
You cannot use the imageSwap() function because input type=image is not included in the document.images[] array which I think you use in accessing the images in your image anchor links.

Here's the link that does the rollover for submit image

http://codingforums.com/showthread.php?s=&threadid=10911

skeatt
Dec 5th, 2002, 07:48 AM
The trick is guessing the right keyword when searching the forum:o

glenngv :thumbsup: for IE5, however...:eek: NN4.7 didn't rollOver.

I'm going to have a play (blindly tinker) with it to see if it can be fixed some way.

glenngv
Dec 5th, 2002, 08:04 AM
NN4 doesn't have onmouseover/onmouseout event handlers for input type=image.

if you really want to make it work with this ancient browser, you can just make a normal link and call document.formNameHere.submit() onclick of the link and use the rollover function you have

skeatt
Dec 5th, 2002, 08:58 AM
document.formNameHere.submit() onclick of the link and use the rollover function you have

I'm Sorry Glenngv,:confused: I think I am trying to go beyond my abilities, because most of that just went over my head.
and I feel :o to ask more. Maybe it just wasn't meant to be.

skeatt
Dec 5th, 2002, 12:28 PM
Glenn: I figured something out...the following works with IE5, sends a formdata.att to the email address after a security warning dialog, but when I click using NN nothing happens, no data sent, (the rollover works though), what could be wrong?

My function.....
function go2() {
document.form1.submit(); }

My form header.....

<form name="form1" method="post" action="mailto:[email protected]">

My onClick link......

<a href="main.html" target="_self" onclick="go2();return false;"
onMouseOver="imageSwap('imgOn','img1','img1')"
onMouseOut="imageSwap('imgOff','img1','img1')"
onMouseDown="imageSwap('imgDn','img1','img1')">
<img name="img1" src="image1off.gif" border="0" alt="Home"></a>

Roy Sinclair
Dec 5th, 2002, 03:54 PM
A very small change is all that's required to make it work in Netscape 4:




function go2() {
document.forms.form1.submit(); }

astro_sk
Jan 9th, 2003, 10:18 PM
Originally posted by Roy Sinclair
A very small change is all that's required to make it work in Netscape 4:




function go2() {
document.forms.form1.submit(); }


you may also want to rearange your JS, somethin like:

if (appName=="Netscape"){
document.forms.form1.submit();
}else{
document.form1.submit();
}