下降的广告栏怎么能加以控制?

ajt99 2013-11-01 01:29:35
<!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>
<title>Introduction to the GNSS and LBS Association of China</title>
<script type="text/javascript" language="javascript">
var time = 500;
var h = 0;
function addCount()
{
if(time>0)
{
time--;
h = h+5;
}
else
{
return;
}
if(h>482) //高度
{
return;
}
document.getElementById("ads").style.display = "";
document.getElementById("ads").style.height = h+"px";
setTimeout("addCount()",30);
}

window.onload = function showAds()
{
addCount();
setTimeout("noneAds()",40000); //停留时间自己适当调整
}
</script>

<script type="text/javascript" language="javascript">
var T = 260;
var N = 260; //高度
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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><style type="text/css">
<!--
body,td,th {
font-size: 12px;
color: #999999;
line-height:20px}
.STYLE1 {
font-size: 24px;
font-weight: bold;
color: #0066CC;
font-family: Arial, Helvetica, sans-serif;
}
.STYLE2 {
font-size: 18px;
font-weight: bold;
color: #333333;
}
.STYLE3 {
font-size: 24px;
color: #666666;
}
-->
</style></head>
<body>
<div id="ads" style="margin:auto; display:none; width:900px; top:0px; height:0px; border:solid 1px #000; background-color:#fafafa; overflow:hidden; text-align:center;">
<td width="900" height="482"><a href="http://www.xiazai.com"><img src="1.gif" border="0" alt="A5下载"></a></td>
</div>
<div style="margin:auto; width:900px; height:80px; border:solid 1px #000; background-color:#fafafa; text-align:center;">
<div align="center"><br>
<span class="STYLE1">Introduction to the GNSS and LBS Association of China</span><br>
<span class="STYLE2"> </span><br>
</div>
<p align="center" class="STYLE3"></p>
<p align="center" class="STYLE3"></p>
</div>
</body>
</html>
...全文
134 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ajt99 2013-11-01
  • 打赏
  • 举报
回复
谢谢,我看到那个效果了。给你分,版主
teemai 2013-11-01
  • 打赏
  • 举报
回复
引用 4 楼 ajt99 的回复:
我不想30秒,因为内容比较多,我想加个按钮之类的点关闭,不知道怎么做
回复我的时候引用我的回复,这样我才能知道 试试这个:

<!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>
    <title>Introduction to the GNSS and LBS Association of China</title>
   <script type="text/javascript" language="javascript">
    var time = 500;
    var h = 0;
    function addCount()
    {
        if(time>0)
        {
            time--;
            h = h+5;
        }
        else
        {
            return;
        }
        if(h>482)  //高度
        {
            return;
        }
        document.getElementById("ads").style.display = "";
        document.getElementById("ads").style.height = h+"px";
        setTimeout("addCount()",30); 
    }
    
    window.onload = function showAds()
    {
        addCount();
        setTimeout("noneAds()",40000); //停留时间自己适当调整
    }
    </script>
    
    <script type="text/javascript" language="javascript">
    var T = 260;
    var N = 260; //高度
    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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><style type="text/css">
<!--
body,td,th {
    font-size: 12px;
    color: #999999;
line-height:20px}
.STYLE1 {
font-size: 24px;
font-weight: bold;
color: #0066CC;
font-family: Arial, Helvetica, sans-serif;
}
.STYLE2 {
font-size: 18px;
font-weight: bold;
color: #333333;
}
.STYLE3 {
font-size: 24px;
color: #666666;
}
-->
</style></head>
<body>
    <div id="ads" style="margin:auto; display:none; width:900px; top:0px; height:0px; border:solid 1px #000; background-color:#fafafa; overflow:hidden; text-align:center;">
<td width="900" height="482"><a href="http://www.xiazai.com"><img src="1.gif" border="0" alt="A5下载"></a></td>
    </div>
    <div id="bottom" style="margin:auto; width:900px; height:80px; border:solid 1px #000; background-color:#fafafa; text-align:center;">
          <div align="center"><br>
              <span class="STYLE1">Introduction to the GNSS and LBS Association of China</span><br>
              <span class="STYLE2">          </span><br>
			  <input type="button" value="remove A5 download" onclick="javascript:document.getElementById('ads').remove();" />
			  <input type="button" value="remove bottom" onclick="javascript:document.getElementById('bottom').remove();" />
          </div>
        <p align="center" class="STYLE3"></p>
        <p align="center" class="STYLE3"></p>
    </div>
</body>
</html>
ajt99 2013-11-01
  • 打赏
  • 举报
回复
我不想30秒,因为内容比较多,我想加个按钮之类的点关闭,不知道怎么做
teemai 2013-11-01
  • 打赏
  • 举报
回复
这段js代码是控制广告div往下滚动,然后30s后再收上去

 function addCount()
    {
        if(time>0)
        {
            time--;
            h = h+5;
        }
        else
        {
            return;
        }
        if(h>482)  //高度
        {
            return;
        }
        document.getElementById("ads").style.display = "";
        document.getElementById("ads").style.height = h+"px";
        setTimeout("addCount()",30); 
    }
teemai 2013-11-01
  • 打赏
  • 举报
回复
什么叫加以控制?你想要做什么,问题说清楚点
ajt99 2013-11-01
  • 打赏
  • 举报
回复
我想加个鼠标控制或者按钮控制,他这个是计时的,我想点一下按钮收起,应该加个什么样的按钮?

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧