<!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 runat="server">
<title>无标题页</title>
<script language=javascript>
function unselectall(){
if(document.myform.chkAll.checked){
document.myform.chkAll.checked = document.myform.chkAll.checked&0;
}
}
function CheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.Name != 'chkAll'&&e.disabled==false)
e.checked = form.chkAll.checked;
}
}
function aa(){
var r=document.getElementsByName("id");
for(var i=0;i<r.length;i++){
if(r[i].checked){
alert(r[i].value+","+r[i].nextSibling.nodeValue);
}
}
}
</script>
</head>
<body>
<form name="myform" method="post" id="myform" action="" >
<input name='id' type='checkbox' onclick='unselectall()' id='id' value='1'> 设计家园
<input name='id' type='checkbox' onclick='unselectall()' id='Checkbox1' value='2'> 网页教程
<input name='id' type='checkbox' onclick='unselectall()' id='Checkbox2' value='3'> 酷站欣赏
<input name='id' type='checkbox' onclick='unselectall()' id='Checkbox3' value='4'> 网页素材
<input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form)' value='checkbox'>
全选
<input type="button" onclick="aa()" value="选中值">
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script language=javascript>
function unselectall(){
if(document.myform.chkAll.checked){
document.myform.chkAll.checked = document.myform.chkAll.checked&0;
}
}
function CheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.Name != 'chkAll'&&e.disabled==false)
e.checked = form.chkAll.checked;
}
}
function aa(){
var r=document.getElementsByName("id");
for(var i=0;i<r.length;i++){
if(r[i].checked){
alert(r[i].value+","+r[i].nextSibling.nodeValue);
}
}
}
</script>
</head>
<body>
<form name="myform" method="post" id="myform" action="" >
<input name='id' type='checkbox' onclick='unselectall()' id='id' value='1'> 设计家园
<input name='id' type='checkbox' onclick='unselectall()' id='Checkbox1' value='2'> 网页教程
<input name='id' type='checkbox' onclick='unselectall()' id='Checkbox2' value='3'> 酷站欣赏
<input name='id' type='checkbox' onclick='unselectall()' id='Checkbox3' value='4'> 网页素材
<input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form)' value='checkbox'>
全选
<input type="button" onclick="aa()" value="选中值">
</form>
</body>
</html>