javascript当中getElementsByName的用法
马克- to-win:马克 java社区:防盗版实名手机尾号: 73203。
例 3.1 getElementsByName()IEFF.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
</HEAD>
<BODY>
<script type="text/javascript">
<!--
function choiceAll(t)
{
var arr = document.getElementsByName("ch");
for (var i=0;i<arr.length ;i++ )
{
arr[i].checked = t
}
}
//-->
</script>
<INPUT TYPE="checkbox" onclick="choiceAll(this.checked)" >全选<P>
<INPUT TYPE="checkbox" NAME="ch"><BR>
<INPUT TYPE="checkbox" NAME="ch"><BR>
<INPUT TYPE="checkbox" NAME="ch"><BR>
<INPUT TYPE="checkbox" NAME="ch"><BR>
<INPUT TYPE="checkbox" NAME="ch"><BR>
</BODY>
</HTML>