javascript当中getElementsByName的用法

3.getElementsByName     
例 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)
{undefined
    var arr = document.getElementsByName("ch");
    for (var i=0;i<arr.length ;i++ )
    {undefined
        arr[i].checked = t
    }
}
//-->
</script>
<INPUT TYPE="checkbox" οnclick="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>

更多内容请见原文,文章转载自:https://blog.csdn.net/qq_43650923/article/details/102456097

posted @ 2021-12-09 17:05  malala  阅读(178)  评论(0编辑  收藏  举报