Home >Backend Development >PHP Tutorial >Example sharing of pop-up dialog box using php and js
js can realize pop-up dialog boxes. This article mainly shares with you examples of php and js realizing pop-up dialog boxes. I hope it can help everyone.
1. php pops up a dialog box
//弹出对话框<?phpecho "<script language=\"JavaScript\">alert(\"你好\");</script>";?> //关闭当前页 echo " <script> window.self.close(); </script> ";
2. If you need php to pop up a dialog box and return to the original page, you can write like this
<?php echo "<script language=\"JavaScript\">\r\n"; echo " alert(\"你好\");\r\n"; echo " history.back();\r\n"; echo "</script>"; exit; ?>
3. If you need PHP to pop up a dialog box and replace the original page with a new page (replace the current history record), the original page can be written like this
<?php echo "<script language=\"JavaScript\">\r\n"; echo " alert(\"你好\");\r\n"; echo " location.replace(\"http://www.asm32.net/\");\r\n"; // 自己修改网址 echo "</script>"; exit; ?>
Related recommendations:
jQuery timed hidden dialog box code sharing
js and html5 realize the generation of automatic arrangement dialog box
js makes a simple Dialog tutorial
The above is the detailed content of Example sharing of pop-up dialog box using php and js. For more information, please follow other related articles on the PHP Chinese website!