onclick does not work with Input type=image

Discussion in 'Javascript' started by Wayne, Oct 9, 2003.

  1. Wayne

    Wayne Guest

    Please help... For some odd reason onclick is not working with and
    <input type="image"> but works fine on an <input type="button">....

    This does not work:
    <input TYPE="image" src="go.gif"
    onclick="thisthis(form.text1.value,form.select1.value)">

    But this works fine:
    <input TYPE="button" width="20" VALUE="SEARCH"
    onclick="thisthis(form.text1.value,form.select1.value)">

    Any help would be much appreciated... Thanks
     
    Wayne, Oct 9, 2003
    #1
    1. Advertisements

  2. Wayne

    Lee Guest

    Wayne said:
    The odd reason is that the input of type image was intended
    specifically to submit the form. If you want to do something
    other than submit a form, use the onClick handler of an image,
    or of a Link containing an image.
     
    Lee, Oct 9, 2003
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.