[thelist] input type="image" vs. input type="button"

Christian Heilmann codepo8 at gmail.com
Mon Aug 21 16:22:50 CDT 2006


> I would like to use a custom image for the button on the example form
> below.  Using an image for the button breaks the form's functionality, but
> I am not sure why?

Well, several things spring to mind. However, the biggest mistake of
this form is that you rely on JavaScript to send a user to another
page, and that is just not a clever move.

If you want to redirect via a dropdown and JavaScript, use the
onsubmit handler on the form, then there is no difference between
image button or submit button. Furthermore, you can provide a PHP
script that redirects when JS is not available.

You can find an example in the first chapter here:
http://www.onlinetools.org/articles/unobtrusivejavascript/chapter1.html

-- 
Chris Heilmann
Book: http://www.beginningjavascript.com
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/



More information about the thelist mailing list