qq悬浮代码(兼容各个浏览器)
qq悬浮代码(兼容各个浏览器)
发布时间:2016-12-30 来源:查字典编辑
摘要:复制代码代码如下:lastScrollY=0;functionheartBeat(){vardiffY;if(document.docume...

复制代码 代码如下:

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

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("ad_left").style.top=parseInt(document.getElementById

("ad_left").style.top)+percent+"px";

document.getElementById("ad_right").style.top=parseInt(document.getElementById

("ad_left").style.top)+percent+"px";

lastScrollY=lastScrollY+percent;

//alert(lastScrollY);

}

function hidead(num)

{

showad = false;

if(num==1)

document.getElementById("ad_left").style.display="none";

else if(num==2)

document.getElementById("ad_right").style.display="none";

}

var ClosebuttonHtml1 = '<div><a href="javascript:void(0);">关闭</a></div>';

var ClosebuttonHtml2 = '<div><a href="javascript:void(1);">关闭</a></div>';

ad1="<div id=/"ad_left/"></div>"

ad2="<DIV id=/"ad_right/"><br><a href='tencent://message/?uin=758541860&Menu=yes'><img height='120' src='../images/qq.gif' border='0' width='110'></a></div>";

document.write(ad1);

document.write(ad2);

window.setInterval("heartBeat()",1);

</script>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新Javascript教程学习
热门Javascript教程学习
编程开发子分类