标签:
<html> <head> <title>damel11</title> <script type="text/javascript"> function checkAll(){ var fruits = document.getElementsByName("fruit"); var btn = document.getElementById("aa"); if(btn.value=="全选"){ for( var i = 0; i< fruits.length;i++){ fruits[i].checked = true; } btn.value = "全不选"; }else{ for( var i = 0; i< fruits.length;i++){ fruits[i].checked = false; } btn.value = "全选"; } } function check1(){ var cd = document.getElementById("cd"); var fruits = document.getElementsByName("fruit"); for(var i = 0;i < fruits.length;i++){ fruits[i].checked= cd.checked; } } function message(){ alert("请再认真核对一遍!") alert("删除成功!"); //window.open("damel11.html"); } </script> </head> <body> <input type="checkbox" name="fruit"/>苹果<br/> <input type="checkbox" name="fruit"/>香蕉<br/> <input type="checkbox" name="fruit"/>葡萄<br/> <input type="checkbox" name="fruit"/>火龙果<br/> <input type="checkbox" name="fruit"/>橘子<br/> <input type="checkbox" name="fruit"/>水蜜桃<br/> <input type="checkbox" id="cd" onclick="check1()"/>全选/全不选<br/> <input type="button" value="全选" id="aa" onclick="checkAll()"/> <input type="submit" value="确定"onclick="message()"/> <br/> </body> </html>
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/wei_chong_chong/article/details/47271575