View Full Version : reset button
jolietjake
10-02-2002, 12:07 PM
Hello! Here's a question:
Is there anyway to emulate the reset button with javascript? I have a input type="reset" and I want to substitute it for an image, so I need to do a reset (with javascript) when onclick on this image
Can anyone helpme? thanks.
--------------------------------------------
Joliet Jake, Master of Blues & Rithm:cool:
Alekz
10-02-2002, 12:27 PM
Hi
Not sure, but it should be the same as for submit... Try:
<img src="..." onclick="document.frm.reset()">
Alex
jolietjake
10-02-2002, 12:38 PM
Nope, I think.
I put on my image this code:
onClick="javascript:document.form1.reset();"
and this other code:
onClick="javascript:document.forms[0].reset();"
and no one works.
Any other solution?. Thanks anyway.
--------------------------------------------
Joliet Jake, Master of Blues & Rithm:cool:
whammy
10-02-2002, 01:05 PM
It does work - so there must be another problem. Try this to see:
<form name="form1">
<select name="select1">
<option value=""></option>
<option value="One">One</option>
<option value="Two">Two</option>
<option value="Three">Three</option>
</select>
<br />
<input type="text" name="text1" />
<br />
<input type="radio" name="radio1" />
<br />
<input type="checkbox" name="checkbox1" />
<br />
</form>
<br />
<a href="javascript:document.form1.reset()">Reset Form</a>
adios
10-02-2002, 05:24 PM
Not using Netscape(4) are you?
<html>
<head>
<title>untitled</title>
</head>
<body>
<img src="http://www.codingforums.com/images/reply.gif"
onload="this.onmousedown=function(){this.clicked=true};
this.onmouseup=function(){if(this.clicked)document.forms[0].reset();this.clicked=false}">
<form>
<input type="text" value="default value">
</form>
</body>
</html>
:rolleyes:
Garadon
10-02-2002, 06:01 PM
here is a little trick I once accidently found out :D
<INPUT TYPE=IMAGE SRC=ImageUrl TYPE=reset NAME=Create>
whammy
10-03-2002, 02:49 AM
I seriously think that browser support for anything less than 4.0 (whatever) should be discontinued! It would be nice if you couldn't even surf with browsers like that. :D
I will probably implement something like that into my website like "You REALLY need to upgrade your browser... you know all of those errors you get every time you try to surf the internet? Just click the link below and it will solve all of your problems!"
And to be honest I don't really care which browser they download as long as it's better than NS 4.x, and supports regular expressions in javascript ... since I try to use robust code that is cross-browser. :|
jolietjake
10-03-2002, 09:08 AM
Ok, I tried it on another page and works, so I have some wrong code in the first page (but i don't find it).
Ok, ok, You're all right. I'll try to find out the wrong code (it's a huge page, so I cannot put here)
Thanks for the help
--------------------------------------------
Joliet Jake, Master of Blues & Rithm:cool:
try this:
<input type="image" src="..." onclick="document.frm.reset()">
or possibly use img instead of image.
If that doesn't work, or something like it, you can use this as a backup:
<a href="#" onClick=" document.frm.reset()"><img src="..."></a>
Goodluck!!!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.