<SCRIPT language=javascript> <!-- function CheckForm() { var form=document.myform; if (form.UserName.value=='') { alert("请输入用户名!"); form.UserName.focus(); return false; } if (form.PassWord.value=='') { alert("请输入密码!"); form.PassWord.focus(); return false; } form.Submit.value="登 录"; form.Submit.disabled=true; form.submit(); return true; } //--> </SCRIPT> <html> <head> <style> li{list-style-type:none;} </style> <script> document.write("<ul>"); for(var i=0;i<10;i++){ document.write("<li>"); document.write("下一个天亮"); document.write("<input type='checkbox' name='ck' value=''>"); document.write("</li>"); } document.write("</ul>"); var ip=document.getElementsByName('ck'); function soul(){ var ip=document.getElementsByName('ck'); for(var j=0;j<ip.length;j++){ ip[j].checked=true; } } function qk(){ for(var j=0;j<ip.length;j++){ ip[j].checked=false; } } function revers(){ for(var j=0;j<ip.length;j++){ if(ip[j].checked==true){ ip[j].checked=false; }else{ ip[j].checked=true; } } } function del(){ for(var j=0;j<ip.length;j++){ if(ip[j].checked==true){ ip[j].parentNode.style.display="none"; } } } </script> </head> <body> <input type="button" value="全选" onClick="soul()"> <input type="button" value="清空" onClick="qk()"> <input type="button" value="反选" onClick="revers()"> <input type="button" value="删除" onClick="del()"> </body> </html> |