在网页中加对联广告代码(超简单)

http://www.itjxue.com  2015-08-27 00:26  来源:未知  点击次数: 

复制下面代码放到js文件里就行了 导入用<script language="javascript" src="你的js文件名.js"></script>放到你的首页就可以了 你应该满意这段代码的效果吧 兼容firefoxf/ie/chrome

以下是js文件代码直接复制即可: 
/* 
Powered by http://www.itjxue.com/ v8.7 Certificate
 */
lastScrollY=0;
function heartBeat(){
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
diffY = document.documentElement.scrollTop;
else if (document.body)
diffY = document.body.scrollTop
else
{/*Netscape stuff*/}
//alert(diffY);
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.getElementById("LeftAd").style.top=parseInt(document.getElementById("LeftAd").style.top)+percent+"px";
document.getElementById("RightAd").style.top=parseInt(document.getElementById("LeftAd").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
//alert(lastScrollY);
}
suspendcode12="<DIV id=LeftAd style='left:5px;POSITION:absolute;TOP:80px;'><img src='http://d.lanrentuku.com/down/js/duilian-528/images/duilian.jpg ' ><a style='text-align:left; cursor: hand; display:block; background:#eee; width:100px;' href='javascript:void(0)' onclick='javascript:ClosedivLeft()' hidefocus='true'>关闭</a></div>"
suspendcode14="<DIV id=RightAd style='right:5px;POSITION:absolute;TOP:80px;'><img src='http://www.itjxue.com/templets/img/logo.gif ' ><a style='text-align:left; cursor: hand; display:block; background:#eee; width:180px;' href='javascript:void(0)' onclick='javascript:ClosedivRight()' hidefocus='true'>关闭</a></div>"
document.write(suspendcode12);
document.write(suspendcode14);
window.setInterval("heartBeat()",1);
function ClosedivLeft()
{
LeftAd.style.visibility="hidden";
}
function ClosedivRight()
{
RightAd.style.visibility="hidden";
}

上面2张图片最好是一样大的,如果发现底部关闭按钮短于或者长于图片广告图片的宽度,那么修改上面图片地址后面有个 width:100px;将100改成自己广告图片的宽度即可!

(责任编辑:IT教学网)

更多
上一篇:没有了

相关广告特效文章

推荐广告特效文章