Select all
Box1
Box2
Box3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Check All...codesstore.blogspot.com</title>
<script type="text/javascript">
//----check all check boxes------
var selectFlag=true;
function selectAll(){
var list=document.getElementsByName('boxlist');
var i=0;
if (selectFlag){
for(i;i<list.length;i++){
list[i].checked = true;
}
document.getElementById('link').innerHTML="Deselect all";
selectFlag=false;
}
else{
for(i;i<list.length;i++){
list[i].checked = false;
}
document.getElementById('link').innerHTML="Select all";
selectFlag=true;
}
}
</script>
</head>
<body>
<a id="link" href="javascript:selectAll();">Select all</a><br>
<input type="checkbox" name="boxlist">Box1<br>
<input type="checkbox" name="boxlist">Box2<br>
<input type="checkbox" name="boxlist">Box3<br>
</body>
</html>
No comments:
Post a Comment