您的位置:首页 > 其它

【CheckBox】选择或取消所有CheckBox

2008-04-09 15:39 330 查看
<SCRIPT LANGUAGE="JavaScript">

<!--

// This script checks and unchecks boxes on a form

// Checks and unchecks unlimited number in the group

// Pass the Checkbox group name

// call buttons as so:

// <input type=button name="CheckAll" value="Check All"

//onClick="checkAll(this)">

// <input type=button name="UnCheckAll" value="Uncheck All"

//onClick="uncheckAll(this)">

// -->

<!-- Begin

function checkAll(theElement) {

var theForm = theElement.form, z = 0;

for(z=0; z<theForm.length;z++){

if(theForm[z].type == 'checkbox'){

theForm[z].checked = true;

}

}

}

function uncheckAll(theElement) {

var theForm = theElement.form, z = 0;

for(z=0; z<theForm.length;z++){

if(theForm[z].type == 'checkbox'){

theForm[z].checked = false;

}

}

}

// End -->

</script>

Your Favorite Scripts & Languages

Java

Javascript

Active Server Pages

HTML

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