我有一个显示广告的广告弹出窗口。但是,我被推荐使用Create a one-time popup using jQuery中的代码。弹出窗口工作正常,并且在设置 cookie 时也被禁用。但是这个弹出窗口不会立即出现在我的网站首页加载中。当我导航到另一个页面后,它会出现。我只是希望它在第一个站点加载时打开。
这是我的代码:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage"%>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="ROBOTS" content="ALL,INDEX,FOLLOW"/>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/slide.js" type="text/javascript"></script>
<script src="js/jquery.cookie.js" type="text/javascript"></script>
<script src="js/thickbox.js" type="text/javascript"></script>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&;lang=en"></script>
</head>
<body onload="init()">
<div id="loading" style="position:absolute; width:100%; text-align:center; top:300px;"><img src="images/loading.gif" alt=""/></div>
<script type="text/javascript">
var ld = (document.all);
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
if (ns4)
ld = document.loading;
else if (ns6)
ld = document.getElementById("loading").style;
else if (ie4)
ld = document.all.loading.style;
function init() {
if (ns4) { ld.visibility = "hidden"; }
else if (ns6 || ie4) ld.display = "none";
}
</script>
<script type="text/javascript">
$(document).ready(function(){
if ($.cookie('20080521') != '1') {
tb_show("<strong>Seminar on Total Investment!</strong>", "#TB_inline?height=190&width=275&inlineId=mypopup","");
$.cookie('20080521', '1', { expires: 20 }); }
});
</script>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div id="mypopup" style="display:none"><p id="msg">Seminar on Total Investment By Mr.Samir Shah. Contact: 9727152508</p></div>