Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reset/Clear Button won't work with an Image!

Status
Not open for further replies.

programmher

Programmer
Joined
May 25, 2000
Messages
235
Location
US
For some reason, when I attempt to use an image file to trigger a form reset or clear, the image submits the form instead of resetting it. Here is my code. Has anyone else seen this? If so, how did you resolve this issue?

<input type=&quot;image&quot; name=&quot;Reset&quot; id=&quot;Reset&quot; src=&quot;reset.jpg&quot;>

 
this is the definition of the image type field for the input element:

IMAGE : An image field upon which you can click with a pointing device, causing the form to be immediately submitted. The co-ordinates of the selected point are measured in pixel units from the upper-left corner of the image, and are returned (along with the other contents of the form) in two name/value pairs. The x-co-ordinate is submitted under the name of the field with .x appended, and the y- co-ordinate is submitted under the name of the field with .y appended. The NAME attribute is required. The image itself is specified by the SRC attribute, exactly as for the Image element.

try using button type...
Sylvano
dsylvano@hotmail.com
 
Web Arachnid,

Thanks for the suggestion. When I use the button type, my image is ignored. <input type=&quot;button&quot; name=&quot;Reset&quot; src=&quot;reset.jpg&quot;>

Am I missing some key element? I also tried Java Scripting an onClick command.

What am I missing?
 
try this:

<form name=&quot;myForm&quot;>
...
<a href=&quot;#&quot; onClick=&quot;document.myForm.reset()&quot;><img src=&quot;reset.gif&quot;></a>
</form>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top