您的位置:首页 > Web前端 > JavaScript

js脚本checkBox全选的方法

2011-09-18 18:48 369 查看
js脚本checkBox全选的方法

function selected1(spanChk)

{

  var oItem = spanChk.children;

var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];

  xState=theBox.checked;

  elm=theBox.form.elements;

  for(i=0;i<elm.length;i++)

  if(elm[i].type=="checkbox" && elm[i].id!=theBox.id&&elm[i].id!='cbBool')

  {

   if(elm[i].checked!=xState)

   elm[i].click();

  }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: