Ultra fast cheap  linux and windows hosting
javascript tutorial Browse Basic JavaScript Tutorial
Browse JavaScript Script resources
Browse javascript FAQS
Categories:

javascript tutorial
buy template
Home >> Tutorials >> Advanced javascript tutorials
Javascript >> checkbox>> Check all input

Check all input: If you have a lot of checkboxes in your form then it is a good idea to provide check all link . A common example is asking the users to sign in for newsletter in selected categories.Some times the user want to selects all categiries. See the following example.


copy the following piece of javascript code and try.

<script language=JavaScript>
function checkall()
{
void(d=document);
void(el=d.getElementsByName('check'));
for(i=0;i<el.length;i++)
void(el[i].checked=1)
}
function uncheckall()
{
void(d2=document);
void(e2=d2.getElementsByName('check'));
for(i=0;i<el.length;i++)
void(el[i].checked=0)
}

</script>
<form>
<input type=checkbox name="check">
<input type=checkbox name="check">
<input type=checkbox name="check">
<input type=checkbox name="check">
<input type=checkbox name="check">
<input type=checkbox name="check">
<input type=checkbox name="check">
<input type=button onClick="checkall()" value="Check All" name="button">
<input type=button onClick="uncheckall()" value="UnCheck All" name="button">
</form>

Page contents: itechies.net - Learn how to check all checkboxes , uncheck all check boxes using javascript.
javascript tutorial
javascript book
Buy this book