Click to See Complete Forum and Search --> : Clear function


gnanesh
05-07-2003, 10:38 AM
Folks

I have a button "Clear" , i need to execute this function so that i can clear all the fields in the document...any code appreciated

thanks
gnanesh

khalidali63
05-07-2003, 10:41 AM
actually you do not need any JavaScript code for this.its bhil in html ability.

<inpyt type="reset" value="Reset Form"/>

Charles
05-07-2003, 10:46 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<form action="">
<div>
<button type="submit">Submit</button>
<button type="reset"><img alt="Clear" src="http://forums.webdeveloper.com/avatar.php?userid=33&dateline=1039637273" type="image/png"></button>
<div>
</form>

gnanesh
05-07-2003, 10:48 AM
hi

I did this

<input type="reset" name="clear" alt="<%=clearAll%>" border="0">

but its not working

Let me know

thanks
Gnanesh

khalidali63
05-07-2003, 10:51 AM
the only thing that can be is that the input tag is not inbetween the form tags.

Make sure you have <form start and and end tags and put reset tag in between the form tags

Charles
05-07-2003, 10:52 AM
If you are trying to do what I think that you are trying to do then try:

<button type="reset">
<img alt="Clear All" src="<%=clearAll%>">
</button>

gnanesh
05-07-2003, 10:55 AM
thanks folks

its working, infact the <input> was outside of the <form> tag

Thanks
Gnanesh

gnanesh
05-07-2003, 11:00 AM
One more question:--

If i specify <input type="reset">

I will see the button display as Reset

How do i change the button name i.e. caption like Clear or Clear All

Thanks
Gnanesh

AdamGundry
05-07-2003, 11:06 AM
Specify a value for the button (same as for submit and normal buttons):

<input type="reset" value="Clear">

Adam

gnanesh
05-07-2003, 11:11 AM
thanks