This way
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function CheckUnCheckAll(chkMain) {
var chks = document.getElementsByTagName("input");
for (var i in chks) {
if (chks[i].type == "checkbox") {
chks[i].checked = chkMain.checked;
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<input type = "checkbox" id = "main" onclick = "CheckUnCheckAll(this)" />
<input type = "checkbox" />
<input type = "checkbox" />
<input type = "checkbox" />
<input type = "checkbox" />
<input type = "checkbox" />
<input type = "checkbox" />
<input type = "checkbox" />
</form>
</body>
</html>
It works in all browsers