经典在网站顶部加广告的代码非常酷

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="haha.aspx.cs" Inherits="haha" %>

<!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>
<script type="text/javascript" language="javascript">
    var time = 200;
    var h = 0;
    function addCount()
    {
        if(time>0)        {
            time--;
            h = h+5;
        }
        else
        {
            return;
        }
        if(h>305)  //高度
        {
            return;
        }
        document.getElementById("ads").style.display = "";
        document.getElementById("ads").style.height = h+"px";
        setTimeout("addCount()",30);
    }
   
    window.onload = function showAds()
    {
        addCount();
        setTimeout("noneAds()",8000); //停留时间自己适当调整
    }
    </script>
   
    <script type="text/javascript" language="javascript">
    var T = 305;
    var N = 305; //高度
    function noneAds()
    {
        if(T>0)
        {
            T--;
            N = N-5;
        }
        else
        {
            return;
        }
        if(N<0)
        {
            document.getElementById("ads").style.display = "none";
            return;
        }
       
        document.getElementById("ads").style.height = N+"px";
        setTimeout("noneAds()",30);
    }
    </script>

</head>
<body>
    <div id="ads" style="margin:auto; display:none; width:984px; top:0px; height:0px; border:solid 1px #000; background-color:#fafafa; overflow:hidden; text-align:center;">
<table cellpadding="0" cellspacing="0"><tr><td width="984" height="305"><a href=http://www.66js.com target="_blank" ><img src="images/niu1.jpg" border="0"></a></td></tr></table>
    </div>
   

</body></html>

posted on 2011-06-16 17:46  IT凡人  阅读(555)  评论(2)    收藏  举报

导航