Home > Backend Development > PHP Tutorial > Example sharing of pop-up dialog box using php and js

Example sharing of pop-up dialog box using php and js

小云云
Release: 2023-03-20 19:38:02
Original
4230 people have browsed it

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> ";
Copy after login


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;
?>
Copy after login

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;
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template