JavaScript - How to Submit Form Using Image

Here are two sample code you can try to submit form using image in javascript.

Simple script example is by just adding "action=handle-data.pl" inside form tag and using type=image on input tag.

The code:

<form name="myform" action="handle-data.pl">
Search: <input type='text' name='query'>
<input type="image" src="go.gif">
</form>


More samples and cases:

The code:

<form name="myform" action="handle-data.php">
Search: <input type='text' name='query'>
<a href="javascript: submitform()">
<img src="go.gif" width="33" height="19" border="0">
</a>
</form>

<SCRIPT language="JavaScript1.2">
function submitform()
{
if(document.myform.onsubmit())
{
document.myform.submit();
}
}
</SCRIPT>

See that is simple using javascript to submit form using image; Good luck.