页面载入的动画效果的源代码一例

王朝other·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

带滑动性质的全屏广告特效,设置一定时间可以自动关闭。

<!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>滑动全屏广告knowsky.com</title>

<script type="text/javascript" language="javascript">

var intervalId = null;

function slideAd(id,nStayTime,sState,nMaxHth,nMinHth){

this.stayTime=nStayTime*1000 || 3000;

this.maxHeigth=nMaxHth || 300; //广告最大高度

this.minHeigth=nMinHth || 1;

this.state=sState || "down" ;

var obj = document.getElementById(id);

if(intervalId != null)window.clearInterval(intervalId);

function openBox(){

var h = obj.offsetHeight;

obj.style.height = ((this.state == "down") ? (h +5 ) : (h - 5))+"px";

if(obj.offsetHeight>this.maxHeigth){

window.clearInterval(intervalId);

intervalId=window.setInterval(closeBox,this.stayTime);

}

if (obj.offsetHeight<this.minHeigth){

window.clearInterval(intervalId);

obj.style.display="none";

}

}

function closeBox(){

slideAd(id,this.stayTime,"up",nMaxHth,nMinHth);

}

intervalId = window.setInterval(openBox,2);

}

</script>

</head>

<body>

<div id="slideAD" style="overflow: hidden; height: 0">

<div align="center"><a href="#"><img name="AD" src="" width="778" height="300" alt="广告内容knowsky.com" style="background-color: #FF6600; border:0;" /></a></div>

</div>

<script type="text/javascript">

slideAd('slideAD',5);

</script>

<div style="background-color:#0CF; border-top:2px #3399CC solid; font-size:12px; text-align:center; padding:3px;">滑动全屏广告knowsky.com</div>

</body>

</html>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航