卓越飞翔博客卓越飞翔博客

卓越飞翔 - 您值得收藏的技术分享站
技术文章64336本站已运行4115

php代码弹窗口怎么弄

php 中弹出窗口的实现方法包括:使用 javascript alert 函数;使用 html dom window.alert 方法;使用 php header 函数;自定义弹出窗口。

php代码弹窗口怎么弄

PHP 弹出窗口的实现

使用 JavaScript Alert 函数

echo "<script>alert('弹出窗口的内容');</script>";

使用 HTML DOM Window.alert 方法

echo "<script>window.alert('弹出窗口的内容');</script>";

使用 PHP header 函数

header("Location: popup.html");

自定义弹出窗口

echo "<script type="text/javascript">
function popup() {
  var width = 400;
  var height = 400;
  var left = (screen.width - width) / 2;
  var top = (screen.height - height) / 2;
  var windowFeatures = 'width=' + width + ',height=' + height +
                        ',left=' + left + ',top=' + top;
  var newWindow = window.open('popup.html', '', windowFeatures);
  newWindow.focus();
}
</script>";

echo "<button onclick="popup()">打开自定义弹出窗口</button>";
卓越飞翔博客
上一篇: php代码加密了怎么办
下一篇: php怎么看到源代码
留言与评论(共有 0 条评论)
   
验证码:
隐藏边栏