在网站加载时立即显示弹出窗口

时间:2013-02-07 10:53:06

标签: javascript jquery

我有一个广告弹出窗口显示广告。不过我已经推荐了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>

0 个答案:

没有答案