Per IE
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
function selectAll(value) {
var coll = document.all.tags("INPUT");
if (coll!=null) {
for (i=0; i<coll.length; i++) {
if (coll[i].type == 'checkbox' && coll[i].name != 'selectAll') {
coll[i].checked = value;
} // if (coll[i].type = 'checkbox')
} // for (i=0; i<coll.length; i++)
} // if (coll!=null)
} // function selectAll()
function invert() {
var coll = document.all.tags("INPUT");
if (coll!=null) {
for (i=0; i<coll.length; i++) {
if (coll[i].type == 'checkbox' && coll[i].name != 'selectAll') {
coll[i].checked = ! coll[i].checked ;
} // if (coll[i].type = 'checkbox')
} // for (i=0; i<coll.length; i++)
} // if (coll!=null)
} // function invert()
//-->
</script>
</head>
<body>
Check box 1 <input type="checkbox" id="cb1">
Check box 2 <input type="checkbox" id="cb2">
Check box 3 <input type="checkbox" id="cb3">
Check box 4 <input type="checkbox" id="cb4">
Check box 5 <input type="checkbox" id="cb5">
Check box 6 <input type="checkbox" id="cb6">
Check box 7 <input type="checkbox" id="cb7">
Check box 8 <input type="checkbox" id="cb8">
Check box 9 <input type="checkbox" id="cb9">
<input class="dba" type="button" value="Select all" onclick="selectAll(true);">
<input class="dba" type="button" value="Unselect " onclick="selectAll(false);">
<input class="dba" type="button" value="Invert" onclick="invert();">
</body>
</html>