My <input type="image"> is not working like a <button type="submit">
I used to have a submit button like this:
<button type="submit">Submit</button>
I've now replaced the text with a swanky image that fits the look and feel of my site, but strangely, this 开发者_如何学JAVAisn't working:
<input type="image" src="myimage.gif" alt="Submit" />
In particular, the form "submits", but the other form input values aren't submitted properly.
Ideas?
Very special situation, it turned out.
My form happened to have these two values:
<input type="hidden" id="x" name="x" />
<input type="hidden" id="y" name="y" />
When you change to input type="image", and click submit, variables named x and y return the point at which the user clicked on the submit button - overwriting my actual useful variables x and y.
Renamed my form variables to x-coord and y-coord and it worked perfectly.
精彩评论