<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無(wú)標(biāo)題文檔</title>
<script language="javascript">
function SelectDel() //刪除
{
var obj = Validate();
if(obj == true)
{
if( window.confirm('你確定要?jiǎng)h除?'))
{
return true;
}
else
{
return false;
}
}
else
{
alert('請(qǐng)選擇要?jiǎng)h除的項(xiàng)目!');
}
}
function Validate()
{
var objs = window.document.getElementsByTagName('input');
var i;
for(i=0;i<objs.length;i++)
{
if(objs[i].type=='checkbox')
{
if(objs[i].checked == true)
{
return true;
}
}
}
}
function selectAll() //全選
{
var objs = document.getElementsByTagName('input');
var i;
for(i = 0; i < objs.length; i++)
{
if(objs[i].type == "checkbox")
{
objs[i].checked = true;
}
}
}
function unselect() //反選
{
var objs = document.getElementsByTagName('input');
var i;
for(i=0;i<objs.length;i++)
{
if(objs[i].type=='checkbox')
{
if(objs[i].checked == true)
{
objs[i].checked =false;
}
else
{
objs[i].checked =true;
}
}
}
}
function cancel() //取消
{
var objs = document.getElementsByTagName('input');
var i;
for(i=0;i<objs.length;i++)
{
if(objs[i].type == 'checkbox')
{
objs[i].checked = false;
}
}
}
</script>
</head>
<body>
<form action="" method="post">
a:<input type="checkbox" name="selCBox" /><br />
b:<input type="checkbox" name="selCBox" /><br />
c:<input type="checkbox" name="selCBox" /><br />
d:<input type="checkbox" name="selCBox" /><br />
<input type="button" onclick="return selectAll() " value="全選" name="a"/>
<input type="button" onclick="return unselect() " value="反選"/>
<input type="button" onclick="return SelectDel() " value="刪除"/>
</form>
</body>
</html>
聯(lián)系客服