程序员人生 网站导航

php和js交互一例

栏目:php教程时间:2013-11-03 17:43:31
  1. <html>  
  2. <head>  
  3. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">  
  4. <title>Untitled</title>  
  5. <script language="JavaScript">  
  6. <!--  
  7. function rec_delete(message){  
  8. return confirm(message);  
  9. }  
  10. //-->  
  11. </script>  
  12. </head>  
  13. <body>  
  14. <?php  
  15. $myrow[guest_name]="asdf"";  
  16. $myrow[guest_name]="asdf'";  
  17. $guest_name=addslashes($myrow[guest_name]);  
  18. //$guest_name=str2js($myrow[guest_name],"'");  
  19. $dele_mess="真的要删除这个留言吗? 留言姓名:$guest_name($myrow[guest_ip])"." 留言时间:$myrow[guest_time]";  
  20. echo "<script>";  
  21. echo "delete_mess="$dele_mess"";  
  22. echo "</script>";  
  23. ?>  
  24. <a href="<?php echo "$PHP_SELF?opt=delete"; ?>" onClick='return rec_delete(delete_mess)'>删除</a>  
  25. </body>  
  26. </html>  
------分隔线----------------------------
------分隔线----------------------------

最新技术推荐