Forum Moderators: open

Message Too Old, No Replies

Rollover for submit button in a form

         

dreaming of nascar

7:26 pm on Feb 22, 2003 (gmt 0)

10+ Year Member



Hi -
How do I make my button (that is an image) use the onMouseOver/Out effects and submit the contents of a form to the appropriate page? I have tried <INPUT TYPE=image onMouseOver=change image and... onMouseOut=change back image and...> This doesn't work. I get errors. When I use <A href=image onMouseOver=change image and... onMouseOut=change back image and...> This changes the image like I want, but it doesn't submit any of the form to the appropriate page. If anyone could help me with this I would greatly appreciate it. Hopefully it is fairly easy, I just do not know how to do it. I know it is possible. I have seen many sites with it, but I do not know the code. Any help would be appreciated. Thanks

D O N

tedster

8:02 pm on Feb 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



D.O.N.

Is this a different issue than your Add To Cart Rollover [webmasterworld.com] question?

On the surface of it, I'd have to say the answer is the same: use a javascript onSubmit() function instead of a regular form submit.

dreaming of nascar

3:31 am on Feb 23, 2003 (gmt 0)

10+ Year Member



Could you give me an example of how to use this. I have onSubmit in the <FORM> tag, but that doesn't seem to work. Thanks!

D O N

c3oc3o

2:06 pm on Feb 23, 2003 (gmt 0)

10+ Year Member



"This doesn't work. I get errors."

It *might just* be helpful to quote what code you used exactly, and what error messages that produced.
(If possible, Mozilla JavaScript console error messages would be much preferred to IE's general, unspecific ones)

hakre

3:10 pm on Feb 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi D.O.N.,

maybe your question is a little bit too unspecific. for the standard submit button of html you can't create a rollover.

Birdman

3:13 pm on Feb 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Couldn't you use:

<input type="image" onmouseover="" onmouseout="" src="" />

Sorry, I don't know the actual js, because I never use it.

ShawnR

10:34 am on Mar 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi

Not sure if you are still trying to solve this... If so, the following worked for me:

<a href="javascript:document.yourformsname.submit()" onmouseover="image swapping code..."><img src="yourimage.gif"></a>

(I got it from a 2-yr-old post: [webmasterworld.com ])

I first tried the <input type="image" ...> solution, similar to Birdman's post, but couldn't get it to work... The 'image' form entities don't seem to get into the DOM, so there is no way for the onmouseover function to change the src of the image (unless I was doing something wrong).