最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

超棒的javascript頁(yè)面頂部卷動(dòng)廣告效果

 更新時(shí)間:2007年12月01日 21:53:37   投稿:mdxy-dxy  
本文給大家分享介紹的是利用Javascript實(shí)現(xiàn)的一個(gè)頁(yè)面頂部卷動(dòng)廣告效果,通過(guò)文字按鈕可以控制廣告的打開和關(guān)閉,文中給出了完整的實(shí)例代碼,大家可以直接運(yùn)行調(diào)試,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧

前言

這篇文章主要介紹了關(guān)于利用javascript實(shí)現(xiàn)的超棒的頁(yè)面頂部卷動(dòng)廣告效果,主要通過(guò)控制圖片外層div來(lái)實(shí)現(xiàn)的,下面話不多說(shuō)了,來(lái)一起看看詳細(xì)的介紹吧。

實(shí)例代碼:

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無(wú)標(biāo)題文檔</title>
<style type="text/css"> 
<!-- 
body { margin:0;background:#000; } 
img { border:0; } 
--> 
</style> 
<script type="text/javascript"> 
<!-- 
var nowheight=0;  //初始廣告層高度 
var maxheight=224;  //廣告層最大高度 
var adobj; 
var opendiv; 
var closdiv; 
var addfunc; 
var handobj; 
var reducefunc;     
var speed=7;    //層卷動(dòng)速度 
function showtopad() { 
  adobj=document.getElementById("bigad"); 
  opendiv=document.getElementById("opendiv"); 
  closdiv=document.getElementById("closdiv"); 
  if (nowheight<=0) { 
    opendiv.style.display="none"; 
    adobj.style.display="block"; 
    addfunc=setInterval("addheight()",1); 
  } 
} 
function closetopad() { 
  if (nowheight>0) { 
    callreduceheight(); 
    if (typeof(handobj)=="number") { 
      clearTimeout(handobj); 
    } 
  } 
} 
function addheight() { 
  nowheight+=speed; 
  if (nowheight>maxheight) { 
    clearInterval(addfunc); 
    closdiv.style.top=maxheight-30; 
    closdiv.style.display="block"; 
    handobj=setTimeout("callreduceheight()",6000); 
    return; 
  } 
  adobj.style.height=nowheight+"px"; 
} 
function callreduceheight() { 
  closdiv.style.display="none"; 
  reducefunc=setInterval("reduceheight()",1); 
} 
function reduceheight() { 
  adobj.style.height=nowheight+"px"; 
  nowheight-=speed; 
  if (nowheight<=0) { 
    clearInterval(reducefunc); 
    adobj.style.display="none"; 
    opendiv.style.display="block"; 
    return; 
  } 
} 
//--> 
</script> 
</head>

<body>

  <div id="opendiv" style="position:absolute;top:3px;right:3px;z-index:10;padding:3px;border:1px #000 solid; cursor:hand;background:#fff;"><span onclick="showtopad()">打開</span></div> 
  <div id="closdiv" style="position:absolute;right:4px;z-index:10;padding:3px;border:1px #000 solid;display:none;cursor:hand;background:#fff;"><span onclick="closetopad()">關(guān)閉</span></div> 
   
  <div id="bigad" style="width:1003px;height:0;overflow:hidden;display:none;"> 
    <a href="http://m.fzitv.net/" target="_blank"> 
      <img src="http://m.fzitv.net/upload/20071201215241934.jpg"> 
    </a> 
  </div> 
  <p style="margin:5px;text-align:center;font-weight:bold;font-size:14px;color:#fff;"> 
    上面是廣告,你可以點(diǎn)擊看看效果!^_^ 
  </p> 
</body>
</html>

總結(jié)

以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,如果有疑問(wèn)大家可以留言交流,謝謝大家對(duì)腳本之家的支持。

相關(guān)文章

最新評(píng)論

凤城市| 比如县| 文山县| 石阡县| 全南县| 温宿县| 阿巴嘎旗| 建昌县| 株洲市| 无锡市| 河间市| 贺兰县| 梨树县| 伊通| 偏关县| 慈利县| 延川县| 康马县| 大田县| 余江县| 南靖县| 梅州市| 大连市| 五原县| 林周县| 廉江市| 青浦区| 泗洪县| 庆安县| 仁化县| 连州市| 太谷县| 安顺市| 鄄城县| 且末县| 佛教| 威宁| 霍州市| 保康县| 宁河县| 陇川县|