今天在考虑网站的时候,因为网站目前权重还可以,收录速度也快,只要收录了后给的网站文章关键词排名的也不错,于是想借平台做软文发布,故想到给网站添加一个对联广告;考虑了一下然后将最后整出来的效果如下:
具体代码如下:
<!--首页左右浮动广告开始--> <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("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:2px;POSITION:absolute;TOP:120px;'><a href="http://wpa.qq.com/msgrd?v=3&uin=860227477&site=%E2%99%9A%E4%BB%98%E6%B6%9B%E7%BA%AA%E5%AE%9E%E9%98%81%E2%99%9A&menu=yes'><img src='/images/ad.png'></a></div>" suspendcode14="<DIV id=\"lovexin14\" style='right:2px;POSITION:absolute;TOP:120px;'><a href="http://wpa.qq.com/msgrd?v=3&uin=860227477&site=%E2%99%9A%E4%BB%98%E6%B6%9B%E7%BA%AA%E5%AE%9E%E9%98%81%E2%99%9A&menu=yes'><img src='/images/ad.png'></a></div>" document.write(suspendcode12); document.write(suspendcode14); window.setInterval("heartBeat()",1); </script> <style type="text/css"> #lovexin12,#lovexin14{ width:100px; height:400px; background-color:yellow; border:1px solid white; z-index: 10000; } </style> <!--首页左右浮动广告结束-->
将以上代码添加到网站的底部或者首页文件里面,即可生效;