Actually, there are two ways to accomplishing this.
First of all, for DOM-compliant browsers you might consider the following:
Code:
<form ... id="form1">
...
</form>
<img ... onclick="document.getElementById('form1').submit()">
For the other browsers, consider this:
Code:
<form ... name="form1">
</form>
<img ... onclick="document.form1.submit()">
Or a more elegant solution would be to use an intervening submit function to take care of this browser "sniffing" for you:
Code:
<form ... id="form1" name="form1">
</form>
<img src="" onclick="handleSubmit('form1')">
Where the function to handle the submit event looks something like this:
Code:
function handleSubmit(frm) {
if (document.getElementById) {
document.getElementById(frm).submit();
} else {
document.frm.submit();
}
}
Hope this helps!
Bookmarks