<!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" lang= "gb2312" > |
<head> |
<title>网页顶部自动下拉/收缩广告代码(仿京东)</title> |
<meta http-equiv= "content-type" content= "text/html; charset=gb2312" /> |
<script type= "text/javascript" > |
var intervalId = null ; |
function slideAd(id, nStayTime, sState, nMaxHth, nMinHth) |
{ |
this .stayTime = nStayTime * 1000 || 3000; |
this .maxHeigth = nMaxHth || 381; |
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 + 2) : (h - 2)) + "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, 10); |
} |
</script> |
<style type= "text/css" > |
#MyMoveAd { |
overflow:hidden; |
text-align: center; |
height: 0px; |
background-color: #AC010A; |
background-image: url(ad.jpg); |
background-repeat: no-repeat; |
background-position: center center; |
display: block; |
} |
</style> |
</head> |
<body> |
<a href= "#" id= "MyMoveAd" > </a> |
<br> |
<br> |
<h1 style= "text-align:center" ><a href= "http://yuncode.net" target= "_blank" >更多源代码下载</a></h1> |
<script type= "text/javascript" > |
<!-- |
slideAd( 'MyMoveAd' ,3); |
--> |
</script> |
</body> |
</html> |
中级程序员
by: 熊猫小迪 发表于:2015-01-06 15:57:03 顶(1) | 踩(0) 回复
那个图片怎么添加 QQ:545321239
求指导
回复评论