[thelist] MouseOver for graphical submit buttons?

Walter Lee Davis waltd at wdstudio.com
Wed Jan 10 21:57:28 CST 2001


This isn't going to be possible in an <input type=image> graphic 
submit button, since there isn't a link to attach the mouseover event 
to in that case. But what you can do (although it raises the bar for 
your visitor to requiring JavaScript) is to create a function that 
contains the method document.forms[0].submit();, and make that the 
onClick event for your button and your usual onMouseOver event can 
trigger the rollover. The graphical button itself can be set to an 
href of # and that will be the link that carries both events.

So what do you do with the four or five people with JavaScript turned 
off? Vanessa Gregory at SoftPress has this nifty trick: put your 
entire <a href=# onClick=... onMouseOver=...><img src = ... height 
=... width = ... border = 0></a> button and code inside a <script 
language = "JavaScript"> document.write("...") </script> container, 
then set a <noscript><input type = submit></noscript> after it. Best 
of both worlds, although quite a bit of work.

Welcome to the list!

Walter

>This is my first post to the list so please let me know if my request is
>appropriate for this forum.
>
>I would like to use a MouseOver on a graphical submit button in my forms. 
>Any ideas?
>
>Thanks
-- 
__________________________________________

Quality is rarely inexpensive, but it is always a bargain.




More information about the thelist mailing list