日期:2014-05-16  浏览次数:20535 次

如何全选列表框里的数据呀?
点击全选按钮的时候,如何全选多选列表框里的数据呀?

------解决方案--------------------
<html>
<head> <title> </title> </head>
<body>
<script type= 'text/javascript '>
function checkall(cb,f)
{
for(var i=0;i <f.elements.length;i++)
{
var e=f.elements[i];
if (e.name!=cb.name)
e.checked=cb.checked;
}
}
</script>
<form name= 'form1 '>
<input type= 'checkbox ' name= 'chkall ' onclick= 'checkall(this,this.form) '/> 全部选择 <br/>
<input type= 'checkbox ' /> 1 <br/>
<input type= 'checkbox ' /> 2 <br/>
<input type= 'checkbox ' /> 3 <br/>
<input type= 'checkbox ' /> 4 <br/>
<input type= 'checkbox '/> 5 <br/>
<input type= 'checkbox ' /> 6 <br/>
</form>
</body>
</html>


这个效果??