nbsp;HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
批量删除数据 <script> <br /> function del(){ <br /> if(!window.confirm('你是否要删除数据?')){ <br /> return false; <br /> } <br /> function chek(){ <br /> var leng = 3; <br /> if(leng==undefined){ <br /> leng=1; <br /> if(!form1.chk.checked) <br /> document.form1.chk.checked=true; <br /> else <br /> document.form1.chk.checked=false; <br /> }else{ <br /> for( var i = 0; i < leng; i++) <br /> { <br /> if(!form1.chk[i].checked) <br /> document.form1.chk[i].checked = true; <br /> else <br /> <br /> document.form1.chk[i].checked = false; <br /> } <br /> } <br /> return false; <br /> } <br /> </script> $conn=mysql_connect("localhost","root","123456");
mysql_query("set names gb2312");
mysql_select_db("db_mingrisoft");
?>
if(($action==null)or($_GET[action]=="show")) { ?> } if($_POST[action] == "delall"){ if(count($_POST[chk]) echo "<script>alert('请选择记录');history.go(-1);</script>"; else { for($i = 0; $i { $sqlstr = "delete from tb_mrbook where id = ".$_POST[chk][$i]; mysql_query($sqlstr,$conn); /*echo "<script>alert('".$sqlstr."');</script>";*/ } echo "<script>alert('删除成功');location='index1408.php';</script>"; } } ?> 当我单击 全部选择/取消 时为什么复选框不会被选择 <script> <br /> function del(){ <br /> if(!window.confirm('你是否要删除数据?')){ <br /> return false; <br /> } <br /> function chek(){ <br /> var leng = 3; <br /> if(leng==undefined){ <br /> leng=1; <br /> if(!form1.chk.checked) <br /> document.form1.chk.checked=true; <br /> else <br /> document.form1.chk.checked=false; <br /> }else{ <br /> for( var i = 0; i < leng; i++) <br /> { <br /> if(!form1.chk[i].checked) <br /> document.form1.chk[i].checked = true; <br /> else <br /> <br /> document.form1.chk[i].checked = false; <br /> } <br /> } <br /> return false; <br /> } <br /> </script> 这段 代码为什么不执行呢
回复讨论(解决方案) 看不下去了。太乱了,蛋疼得很!
全部选择/取消 没有 del 啊
这段代码window.confirm('你是否要删除数据?') 可以直接写在: 或则:删除 如: 还有就是submit提交的check()方法必须放到form表单
Statement: The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn