Heim  >  Artikel  >  Backend-Entwicklung  >  11行php+js 求改错解决思路

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

WBOY
WBOYOriginal
2016-06-13 13:37:56764Durchsuche

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>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn