Home >Backend Development >PHP Tutorial >11行php+js 求改错解决思路

11行php+js 求改错解决思路

WBOY
WBOYOriginal
2016-06-13 10:07:43968browse

11行php+js 求改错
<script><br />function del(){<br /> if (!confirm("您确定要删除这些记录吗?已提交记录将不能删除!")){<br /> return;<br /> }<br /> document.location = "delete1.php?lmbs=<?php echo urlencode("主题管理");?>&id=<?php echo $array['id'];?>"; <br />}<br /></script>




如果在document.location后加入百度网址,可以正常实现功能。
或许是js里套php哪里错了?

------解决方案--------------------
JScript code
function del(){  if (!confirm("您确定要删除这些记录吗?已提交记录将不能删除!")){ return;  }  document.location = "delete1.php?lmbs=<?php echo urlencode("主题管理");?>&id=<?php echo $array['id'];?>";  }<br><font color="#e78608">------解决方案--------------------</font><br>上面发的还有些问题!<br><script type="text/javascript" src="js/jquery.js"></script><br><script type="text/javascript"><br />$(document).ready(function(){<br />$("#delUserById").click(function(){<br />var id = $(this).parent().find('.userId').val();<br />alert(id);<br /> if (!confirm("您确定要删除这些记录吗?已提交记录将不能删除!")){<br />  return;<br /> }<br /> document.location = "delete1.php?lmbs=<?php echo urlencode("主题管理");?>&id="+id;  <br />});<br />});<br /></script><br><br><div>
<br><input type="button" id="delUserById" value="删除"><br><input class="userId" type="hidden" value="<?php echo $array['id'];?>"><br>
</div><br><br><br>只要你的$array['id']有值,应该可以获取了<div class="clear">
                 
              
              
        
            </div>
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