详情页

网页HTML两边浮动广告JS代码-图片带关闭按钮

时间:2022年11月30日

编辑:佚名

相信不少网友会需要这段JS浮动广告代码,对于不是码农的我来讲只能找完整可用的代码,前段时间在网上也找了不少测试,很多有些小问题,要么就不是想要的效果,今天分享的网页HTML两边浮动广告JS代码是实测可用,压缩包中有两个代码,其中一个图片带关闭按钮,关闭图标素材网上很多,请自行下载下。
网页HTML两边浮动广告JS代码
网页HTML两边浮动广告JS代码
另外竖着并列的多个图片广告数量可增加,两段代码都是漂浮在页面的左右两侧,前端展示没什么问题:
点击下载代码文档
链接: https://pan.baidu.com/s/1hfXqUR0FXm4S8mTrb8ibkQ 提取码: 31t8
并列多广告图两侧浮动广告JS代码 
<script language="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("lovexin12").style.top=parseInt(document.getElementById("lovexin12").style.top)+percent+"px";
document.getElementById("lovexin14").style.top=parseInt(document.getElementById("lovexin12").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
//alert(lastScrollY);
}
suspendcode12="<DIV id=\"lovexin12\" style='left:22px;POSITION:absolute;TOP:55px;'><a href='https://www.1.com' target='_blank'><img border=0 src=/css/1.gif width=150px height=150px></a><hr style='height:3px;border:none;border-top:3px solid #fff;' /><a href='http://www.2.com' target='_blank'><img border=0 src=/css/2.gif width=150px height=150px></a><hr style='height:3px;border:none;border-top:3px solid #fff;' /><a href='http://www.3.com' target='_blank'><img border=0 src=/css/3.gif width=150px height=150px></a><hr style='height:3px;border:none;border-top:3px solid #fff;' /><a href='http://www.4.com' target='_blank'><img border=0 src=/css/4.gif width=150px height=150px></a></div>"
suspendcode14="<DIV id=\"lovexin14\" style='right:22px;POSITION:absolute;TOP:55px;'><a href='https://www.1.com' target='_blank'><img border=0 src=/css/1.gif width=150px height=150px></a><hr style='height:3px;border:none;border-top:3px solid #fff;' /><a href='http://www.2.com' target='_blank'><img border=0 src=/css/2.gif width=150px height=150px></a><hr style='height:3px;border:none;border-top:3px solid #fff;' /><a href='http://www.3.com' target='_blank'><img border=0 src=/css/3.gif width=150px height=150px></a><hr style='height:3px;border:none;border-top:3px solid #fff;' /><a href='http://www.4.com' target='_blank'><img border=0 src=/css/4.gif width=150px height=150px></a></div>"
document.write(suspendcode12);
document.write(suspendcode14);
window.setInterval("heartBeat()",1);
</script>
<DIV style="DISPLAY: none">
</DIV>
单广告图加关闭按钮两侧浮动广告JS代码:
<script language="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("lovexin12").style.top=parseInt(document.getElementById("lovexin12").style.top)+percent+"px";
document.getElementById("lovexin14").style.top=parseInt(document.getElementById("lovexin12").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
//alert(lastScrollY);
}
suspendcode12="<DIV id=\"lovexin12\" style='left:22px;POSITION:absolute;TOP:69px;'><a href='http://www.krseo.com' target='_blank'><img border=0 src=/UploadFile/ad_1.gif><br><a href=JavaScript:; onclick=\"lovexin12.style.visibility='hidden'\"><img border=0 src=/UploadFile/close.gif></a></div>"
suspendcode14="<DIV id=\"lovexin14\" style='right:22px;POSITION:absolute;TOP:69px;'><a href='http://www.krseo.com' target='_blank'><img border=0 src=/UploadFile/ad_1.gif><br><a href=JavaScript:; onclick=\"lovexin14.style.display = 'none'\"><img border=0 src=/UploadFile/close.gif></div>"
document.write(suspendcode12);
document.write(suspendcode14);
window.setInterval("heartBeat()",1);
</script>
<DIV style="DISPLAY: none">
</DIV>
相关文章
猜你需要