Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

onclick does not work with Input type=image

Question posted by: Wayne (Guest) on July 20th, 2005 11:02 AM
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
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Lee's Avatar
Lee
Guest
n/a Posts
July 20th, 2005
11:03 AM
#2

Re: onclick does not work with Input type=image
Wayne said:[color=blue]
>
>Please help... For some odd reason onclick is not working with and
><input type="image"> but works fine on an <input type="button">....[/color]

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.


 
Not the answer you were looking for? Post your question . . .
183,631 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors