我想製作一個網站,每個獨特用戶在24小時內出現一次彈出窗口。爲此我使用bPopup和餅乾。我已經嘗試了很多東西,現在我在代碼中有點「迷失」了。你能幫我讓它工作嗎?用於彈出式處理的餅乾
代碼:
<?php
if (!isset($_COOKIE["Seen"])){
if ($_COOKIE['Seen'] != 'true') {
setcookie('Seen', 'false');
}
}
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"> </script>
<script type="text/javascript" src="js/popup.js"> </script>
<LINK REL=StyleSheet HREF="style/style.css" TYPE="text/css" MEDIA=screen>
<html>
<head> </head>
<body>
<!-- Element to pop up -->
<div <?php if(isset($_COOKIE["Seen"])) {
if ($_COOKIE['Seen'] == 'true') {echo 'style="all:none; visibility:hidden; display:none">';}
else {
echo ' id="element_to_pop_up">';
$value = 'true';
$expire = time()+60*60*24;
setcookie('Seen', $value, $expire);
}
}
?>
<a href="#"class="b-close" style="position:absolute; margin-top:5px; margin-left:550px;"><img src="./image/close.png"><a/>
<iframe frameBorder="0" name="iFrame" width="600" height="500" src="welcome.php" scrolling="no"></iframe>
</div>
</body>
</html>
什麼部分是不工作? – Halcyon
對cookie檢查的if語句或回聲應該有問題。 如果我第一次加載頁面,整個東西都會出現在沒有樣式的情況下,這並不好,因爲它應該與id =「element_to_pop_up」標籤一起出現,以便它看起來應該如何。看到cookie有錯誤的價值,這是很好的。 在第二次加載時,cookie已經具有真正的值,這很好,但id =「element_to_pop_up」似乎不應該是。造型被刪除,這是很好的。 對於第三次加載一切都很好。沒有出現,cookie有真正的價值。 – homa