|
热门文章 |
|
|
|
|
全选、全不选 |
来源:黑马123 更新时间:2009/5/13 13:30:59 阅读次数: 我要投稿 |
|
<SCRIPT LANGUAGE="JavaScript"> var checkflag = "false"; function check(field) { if (checkflag == "false") { for (i = 0; i < field.length; i++) { field[i].checked = true;} checkflag = "true"; return "全不选"; } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } checkflag = "false"; return "全选"; } } </script> <form name=myform action="" method=post> <table> <tr><td> <b>请选择下面的选项</b><br> <input type=checkbox name=list value="1">Java<br> <input type=checkbox name=list value="2">JavaScript<br> <input type=checkbox name=list value="3">ASP<br> <input type=checkbox name=list value="4">HTML<br> <input type=checkbox name=list value="5">SQL<br> <br> <input type=button value="全选" onClick="this.value=check(this.form.list)"> </td></tr> </table> </form> |
|
上一篇文章: 上传之前预览图片下一篇文章: 检查Email的书写格式是否正确的代码 |
|
|