@mjdamatoAug 27.2007 — #I'm assuming English is not your first language. That's not a put down as I don't have any 2nd language. But, your question is not clear.
Are you wanting to clear all text fields? Reset select lists? Reset radio options? Please be specific.
@liccyauthorAug 28.2007 — #well you right is clear that English is no my first language lol. but anyway my problem is the this..
i need a js that will uncheck all the checkboxes before the page is loan w/o any type of buttom that will be uncheck and check it once is click... is that clear now ????
@mjdamatoAug 29.2007 — #Do you mean you want to uncheck all the checkboxes on "load" of the page? Doesn't make sense to me since you should control what fields are checked an which ones are not when the page loads. But, yes it can be done.
Assuming all the checkboxes are inside form tags here is an example:
Simply include this script in the head of the page: function uncheckBoxes() { //Iterate through each form for (f=0; f<document.forms.length; f++) { //Iterate through every element on the form for (e=0; e<document.forms[f].elements.length; e++) { //Determine if element is a checkbox & uncheck it if (document.forms[f].elements[e].type=='checkbox') { document.forms[f].elements[e].checked = false; } } } }
Then include an onload even in the body tag like this: <body onload="uncheckBoxes();">
Here is a complete working example. Just remove/add the onload event to see the difference <html> <head>
<script type="text/javascript">
function uncheckBoxes() { //Iterate through each form for (f=0; f<document.forms.length; f++) { //Iterate through every element on the form for (e=0; e<document.forms[f].elements.length; e++) { //Determine if element is a checkbox & uncheck it if (document.forms[f].elements[e].type=='checkbox') { document.forms[f].elements[e].checked = false; } } } }