1 <SCRIPT LANGUAGE="JavaScript">
           2 
           3 var checkflag = false;
           4     function check(field) 
           5     {
           6 
           7         
           8         if (checkflag == false
           9         {
          10     
          11         if(field.length==null)
          12         {
          13     
          14             field.checked=true;
          15             checkflag =true;
          16             //return false;
          17     
          18         }
          19 
          20             for (i = 0; i < field.length; i++
          21             {
          22                 
          23                 field[i].checked = true;
          24             }
          25             checkflag = true;
          26             //return "false"; 
          27         }else 
          28         {
          29 
          30         if(field.length==null)
          31         {
          32     
          33             field.checked=false;
          34             checkflag =false;
          35             //return true;
          36     
          37         }
          38             for (i = 0; i < field.length; i++
          39             {
          40                 field[i].checked = false
          41             }
          42             checkflag = false;
          43             //return true; 
          44         }
          45     }
          46 </script>
          47 
          48 <html>
          49 <head>
          50 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
          51 <title>無標題文檔</title>
          52 </head>
          53 
          54 <body>
          55 <form name="form1" method="post" action="">
          56   <p>
          57     <input type="checkbox" name="ckbox" value="checkbox"> 
          58     dfg  </p>
          59   <p>
          60   <input type="checkbox" name="ckbox" value="checkbox"> 
          61     dfg  
          62 </p>
          63   <p><br>
          64   <input type="checkbox" name="全選" onClick="this.value=check(this.form.ckbox)">    
          65        全選</p>
          66   <p>&nbsp;  </p>
          67 </form>
          68 </body>
          69 </html>
          70 


          posted on 2007-02-07 09:52 -274°C 閱讀(498) 評論(0)  編輯  收藏 所屬分類: web前端

          常用鏈接

          留言簿(21)

          隨筆分類(265)

          隨筆檔案(242)

          相冊

          JAVA網站

          關注的Blog

          搜索

          •  

          積分與排名

          • 積分 - 916109
          • 排名 - 40

          最新評論

          主站蜘蛛池模板: 湄潭县| 冷水江市| 上蔡县| 北辰区| 卢龙县| 辽宁省| 南涧| 鄂温| 宁陵县| 榆林市| 青铜峡市| 青河县| 双流县| 昌江| 安溪县| 休宁县| 资溪县| 和林格尔县| 广丰县| 武平县| 公主岭市| 灵石县| 民勤县| 秀山| 大冶市| 翼城县| 荥经县| 永春县| 墨脱县| 四子王旗| 晴隆县| 太湖县| 上蔡县| 拜城县| 齐齐哈尔市| 慈利县| 罗平县| 卓尼县| 襄垣县| 寿阳县| 正镶白旗|