Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
http://jsbin.com/?html,js,output
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<form name='sel' method='POST'>
<INPUT TYPE="checkbox" NAME="a">A<br>
<INPUT TYPE="checkbox" NAME="b">B<BR>
<INPUT TYPE="checkbox" NAME="c">C<BR>
<INPUT TYPE="checkbox" NAME="d">D<BR>
<INPUT TYPE="checkbox" NAME="e">E<BR>
</form>
<a href="#" onclick='selall()'>Tudo</a>
<a href="#" onclick='unselall()'>Nenhum</a>
</body>
</html>
Javascript
function selall(){
for(var i=0;i< document.forms[0].elements.length;i++)
window.document.forms[0].elements[i].checked=true;
}
function unselall(){
for( var i=0; i < document.forms[0].elements.length; i++)
window.document.forms[0].elements[i].checked=false;
}
Add Comment
Please, Sign In to add comment