Home > Backend Development > PHP Tutorial > PHP弹出对话框技巧详细解读_PHP

PHP弹出对话框技巧详细解读_PHP

WBOY
Release: 2016-05-29 11:48:11
Original
1023 people have browsed it

许多程序员们运用PHP语言进行WEB开发。那么在网站中通常都会遇到对话框弹出等功能需求。下面我们就为大家详细介绍PHP弹出对话框的相关实现方法。
1. PHP弹出对话框

< &#63;PHP 
echo "< script language=
\"JavaScript\">alert
(\"你好\");< /script>"; 
&#63;> 
//或者
< &#63;PHP 
print "< script language=
\"JavaScript\">alert
(\"你好\");< /script>"; 
&#63;> 
Copy after login

2. 如果需要PHP弹出对话框之后返回原来页面可以这么写

< &#63;PHP 
echo "< script language=
\"JavaScript\">\r\n"; 
echo " alert(\"你好\");\r\n"; 
echo " history.back();\r\n"; 
echo "< /script>"; 
exit; 
&#63;> 
//或者
< &#63;PHP 
print "< script language=
\"JavaScript\">\r\n"; 
print " alert(\"你好\");\r\n"; 
print " history.back();\r\n"; 
print "< /script>"; 
exit; 
&#63;> 
Copy after login

3. 如果需要PHP弹出对话框之后用新的页面替换原来的页面(更换当前历史纪录),原来页面可以这么写

< &#63;PHP 
echo "< script language=
\"JavaScript\">\r\n"; 
echo " alert(\"你好\");\r\n"; 
echo " location.replace
(\"http://www.bitsCN.com/\");
\r\n"; // 自己修改网址 
echo "< /script>"; 
exit; 
&#63;> 
或者

< &#63;PHP 
print "< script language=
\"JavaScript\">\r\n"; 
print " alert(\"你好\");\r\n"; 
print " location.replace
(\"http://www.bitsCN.com/\");
\r\n"; // 自己修改网址 
print "< /script>"; 
exit; 
&#63;> 
Copy after login

本文介绍了PHP弹出对话框的三种状况,希望能够帮助大家熟练掌握PHP弹出对话框的实现方法。

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