Home | All Questions | alt.html FAQ > HTML Forms

How do I create a submit button with a mouseover image swap?

The safe (or at least much safer) way to do that is to make a markup like that dynamically generated and provide a non-scripted alternative in NOSCRIPT. Example:

<script type="text/javascript">
 document.write('<a href="#" '+
  'onclick="document.formName.submit(); return false" '+
  'onmouseover="imageswap();" onmouseout="imageswap();">'+
  '<img src="foo.gif" alt="Send" name="whatever"></a>');
</script>
<noscript><input type="submit" value="Send"></noscript>

(Of course, you can put an image submit button instead of a normal submit button into the NOSCRIPT element.)

Recommended Resources

Discussion

Related Questions