标签:on() ++ click UNC html script style var function
<html> <head> <title></title> </head> <style> </style> <script> window.onload =function(){ var oDiv=document.getElementById(‘div1‘) //获取到那个div var oInput=oDiv.getElementsByTagName(‘input‘) //获取到div下面的所有input document.getElementById(‘chooseAll‘).onclick=function(){ for(var i=0;i<oInput.length;i++){ oInput[i].checked=true } } document.getElementById(‘noChoose‘).onclick=function(){ for(var i=0;i<oInput.length;i++){ oInput[i].checked=false } } } </script> <body> <input id="chooseAll" type="button" value="全选" /> <input id="noChoose" type="button" value="不选"/> <div id="div1"> <input type="checkBox" /> <input type="checkBox" /> <input type="checkBox" /> <input type="checkBox" /> <input type="checkBox" /> <input type="checkBox" /> <input type="checkBox" /> <input type="checkBox" /> <input type="checkBox" /> </div> </body> </html>
标签:on() ++ click UNC html script style var function
原文地址:https://www.cnblogs.com/superCwen/p/9769381.html