新建js文件qq.js,代码如下:
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";
lastScrollY=lastScrollY+percent;
}
suspendcode12="<div id=LeftAd style='background:url(qq.png);text-align:center;font-size:12px;line-height:150%;width:88px;height:183px;left:8px;position:relative;top:3px;'><div style='height:50px'></div><a target=blank href=http://wpa.qq.com/msgrd?V=1&Uin=523993703&Site=www.apsw8.com&Menu=yes><img border='0' SRC=http://wpa.qq.com/pa?p=1:523993703:4 alt='online' style='font-family:Arial'>523993703</a><br/><a target=blank href=http://wpa.qq.com/msgrd?V=1&Uin=523993703&Site=www.apsw8.com&Menu=yes><img border='0' SRC=http://wpa.qq.com/pa?p=1:523993703:4 alt='online'>523993703</a><br/><a target=blank href=http://wpa.qq.com/msgrd?V=1&Uin=523993703&Site=www.apsw8.com&Menu=yes><img border='0' SRC=http://wpa.qq.com/pa?p=1:1125690697:4 alt='online'>523993703</a></div>"
document.write(suspendcode12);
window.setInterval("heartBeat()",1);
function ClosedivLeft()
{
LeftAd.style.visibility="hidden";
}
红色是背景图片,
最后在body里加入<script src="qq.js" type="text/javascript"></script>,注意路径哦!也可以加入层,<div id="Layer2" style="position:absolute; left:909px; top:278px; width:96px; height:264px; z-index:2">
<script src="qq.js" type="text/javascript"></script></div>
代码很方便,有问题留言!
没有评论:
发表评论