HTML javascript form submitted when image input button

Posted by DreamU on Stack Overflow See other posts from Stack Overflow or by DreamU
Published on 2010-04-01T15:39:28Z Indexed on 2010/04/01 15:43 UTC
Read the original article Hit count: 209

Filed under:
|
|

I have a form that contains this single input field, which is nothing more than a button to Print the current web page:

<div align="center">
<input type="image" src="../Images/print.jpg" value="Print" onclick="printpage();" /></div>
</div>

After the printing, the page re-submits itself (to itself). Why does it do this and can I stop it?

If I just change the type to "input", this code does not re-submit itself after printing:

<div align="center">
<input type="input" src="../Images/print.jpg" value="Print" onclick="printpage();" /></div>
</div>

Unfortunately, our style conventions require me to use that button image rather than the standard input button.

© Stack Overflow or respective owner

Related posts about html

Related posts about JavaScript