View Full Version : Form image submit button mailto not working

11-09-2006, 03:47 PM
I made an image submit button with rollovers in a form using Javascript. On the href of my submit-image I call a javascript function to submit the form.

Once in the function I can't seem to make the mailto work.

This should work and actually does work when I call the function on the onSubmit of the form instead of the href of the submit-image.

function doSubmit(form){
form.action = 'mailto:myemail@email.com?subject=ItsNotWorking';


<a href="javascript:doSubmit(TheForm)" onMouseOut = "switchImage('submitImage',2)" onMouseOver = "switchImage('submitImage',3)" >
<img name="submitImage" src="images/bt_submit.gif" width="67" height="18" border="0"></a>

When I do this instead with the same function it works.

<FORM NAME="TheForm" ACTION="" METHOD="post" enctype="text/plain" onSubmit="return doSubmit(this)">

I just don't understand why it's not working when I call the function from the image. Any ideas?

11-09-2006, 10:36 PM
Most browsers either ignore action=mailto or just open the email program and ignore the form. If you want to use mailto: then dump the form. If you want to use the form then dump the mailto and use a server side form2mail script.