簡體   English   中英

超時后自動關閉窗口

[英]Automatically close window after timeout

我知道php是服務器端的,但是有沒有辦法讓此窗口在3秒后關閉?

<link rel="stylesheet" type="text/css" href="style1.css" />
<?php 
$contact_message=$_POST['message'];
$errpage = $_POST['frompage'];
$ip=$_SERVER['REMOTE_ADDR'];
$message = "$contact_message -SENT FROM THIS IP: $ip";
mail("maxgee@me.com", "$Error Reported on: $errpage", $message);
echo "We have documented the web address of the problem and thank you for helping us    improve our site!"
?>

應該這樣做:

<script type="text/javascript">setTimeout("window.close();", 3000);</script>

這非常簡單-只需在要移出自身的位置用echo編寫PHP代碼,例如:

<?php

    echo '<script> window.setTimeout("window.close()", 1000); </script>';

?>

它肯定會工作。

如果我正在觀看的頁面突然關閉,可能看起來有點奇怪。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM