Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1119 Can I use an image in place of a button to submit a form? If so, how can I validate which image was selected?

irt.org | Knowledge Base | JavaScript | Image | Q1119 [ previous next ]

Q1119 Can I use an image in place of a button to submit a form? If so, how can I validate which image was selected?

The function you need is document.myForm.submit() It can be called form any event handler - a link is ok:

<form name="myForm">
<input name="whatImage" type="hidden">
</form>

<a href="javascript:document.myForm.whatImage='image1';document.myForm.submit()"><img src="image1.gif"></a>
<a href="javascript:document.myForm.whatImage='image2';document.myForm.submit()"><img src="image2.gif"></a>

Feedback on 'Q1119 Can I use an image in place of a button to submit a form? If so, how can I validate which image was selected?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.