alert('www.php.cn')";"."/> alert('www.php.cn')";".">

Home  >  Article  >  Backend Development  >  Can php generate pop-up windows?

Can php generate pop-up windows?

angryTom
angryTomOriginal
2019-11-01 17:06:317463browse

Can php generate pop-up windows?

Can php generate pop-up windows?

The method of popping up a dialog box in php is as follows. Generally, after submitting the information, a dialog box prompt needs to pop up, and then the dialog box can be automatically closed. The pop-up dialog box has the following concentrated methods. In fact, they all use javascript. alert() method in . Closing the current page after the prompt ends can also be achieved using javascript's Window.self.close().

Exact statements such as: echo " 3f1c4e4b6b16bbbd69b2ee476dc4f83a window.self.close(); 2cacc6d41bbb37262a98f745aa00fbf0 ";

echo "<script>alert(&#39;www.php.cn&#39;)</script>";

More usage:

1. php pops up a dialog box

//弹出对话框
<?php
echo "<script language=\"JavaScript\">alert(\"你好\");</script>";
?>
//关闭当前页
echo   " <script> window.self.close(); </script> ";
或者
<?php
print "<script language=\"JavaScript\">alert(\"你好\");</script>";
?>

2. If you need php to pop up a dialog box and return to the original page, you can write

<?php
echo "<script language=\"JavaScript\">\r\n";
echo " alert(\"你好\");\r\n";
echo " history.back();\r\n";
echo "</script>";
exit;
?>

or

<?php
print "<script language=\"JavaScript\">\r\n";
print " alert(\"你好\");\r\n";
print " history.back();\r\n";
print "</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;
?>

or

<?php
print "<script language=\"JavaScript\">\r\n";
print " alert(\"你好\");\r\n";
print " location.replace(\"http://www.php.cn/\");\r\n"; // 自己修改网址
print "</script>";
exit;
?>

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of Can php generate pop-up windows?. For more information, please follow other related articles on the PHP Chinese website!

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