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 阅读(491) 评论(0)  编辑  收藏 所属分类: web前端

只有注册用户登录后才能发表评论。


网站导航:
 

常用链接

留言簿(21)

随笔分类(265)

随笔档案(242)

相册

JAVA网站

关注的Blog

搜索

  •  

积分与排名

  • 积分 - 908979
  • 排名 - 40

最新评论