页面两侧对联广告(鼠标感应)代码效果

2008-02-23 07:40:34来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

点击此处查看效果

  现在很多网站广告做的如火如荼,现在我就来介绍一下常见的对联浮动广告效果的代码使用方法,本文介绍的这种效果,在1024*768分辨率下正常显示,在800*600的分辨率下可以自动隐藏,以免遮住页面影响访问者浏览内容,而且与前面一个代码不同的是,当鼠标移动到广告图片上是可以感应显示另外设置好的广告大图效果,下面文本框中就是实现效果所需代码:

function bigshow(){
document.all.div_250.style.visibility = 'visible';
document.all.div_80.style.visibility = 'hidden';
}
function bighide(){
document.all.div_80.style.visibility = 'visible';
document.all.div_250.style.visibility = 'hidden';
} var ad_80= new Array(1);
var ad_250= new Array(1); ad_80[0]="<a href=http://www.webjx.com target=_blank><img src=/img2/js050121_1.gif border=0></a>";
ad_250[0]="<a href=http://www.webjx.com target=_blank><img src=/img2/js050121_2.gif border=0></a>"; var imgheight;
var fubioleft;
window.screen.width>800 ? fubioleft=15:fubioleft=15 document.write('<DIV id=floater_left style="Z-INDEX: 25; LEFT:' fubioleft 'px; WIDTH: 28px;POSITION: absolute; TOP: 42px; HEIGHT: 22px">'); ad_now = new Date();
ad_id= ad_now.getSeconds() %1 var adhead1="<div id=div_80 style='position:absolute; width:95px; height:62px; z-index:12' onMouseOver=bigshow();>";
var adhead2="</div><div id=div_250 style='position:absolute; visibility: hidden; z-index:13;width: 80; height: 60' onMouseOut=bighide();>"; document.write(adhead1 ad_80[ad_id] adhead2 ad_250[ad_id] "</div>"); document.write ("</div>");
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
function heartBeat() {
if(IE) {
diffY = document.body.scrollTop;
diffX = document.body.scrollLeft; }
if(NS) {
diffY = self.pageYOffset; diffX = self.pageXOffset; }
if(diffY != lastScrollY) {
percent = .5 * (diffY - lastScrollY);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater_left.style.pixelTop = percent;
if(NS) document.floater_left.top = percent;
lastScrollY = lastScrollY percent;
}
if(diffX != lastScrollX) {
percent = .5 * (diffX - lastScrollX);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater_left.style.pixelLeft = percent;
if(NS) document.floater_left.left = percent;
lastScrollX = lastScrollX percent;
}
}

if(NS || IE) action = window.setInterval("heartBeat()",1);var ad_80= new Array(1);
var ad_250= new Array(1); ad_80[0]="<a href=http://www.webjx.com target=_blank><img src=/img2/js050121_2.gif border=0></a>";
ad_250[0]="<a href=http://www.webjx.com target=_blank><img src=/img2/js050121_1.gif border=0></a>"; var imgheight;
var fubioleft;
window.screen.width>800 ? fubioleft=15:fubioleft=15 document.write('<DIV id=floater_right style="Z-INDEX: 25; LEFT:' fubioleft 'px; WIDTH: 28px;POSITION: absolute; TOP: 42px; HEIGHT: 22px">'); ad_now = new Date();
ad_id= ad_now.getSeconds() %1
function myload()
{
if (navigator.appName == "Netscape")
{
document.div_right_80.pageX= window.innerWidth-130;
document.div_right_250.pageX= window.innerWidth-300;
mymove();
}
else
{
div_right_80.style.left=document.body.offsetWidth-130;
div_right_250.style.left=document.body.offsetWidth-300;
mymove();
}
} function mymove()
{
if(document.ns)
{
document.div_right_80.left=pageXOffset window.innerWidth-130;
document.div_right_250.left=pageXOffset window.innerWidth-300;
setTimeout("mymove();",20)
}
else
{
div_right_80.style.left=document.body.scrollLeft document.body.offsetWidth-145;
div_right_250.style.left=document.body.scrollLeft document.body.offsetWidth-300;
setTimeout("mymove();",20)
}
} var adhead1="<div id=div_right_80 style='position:absolute; width:95px; height:60px; z-index:12' onMouseOver=bigshow_right();>";
var adhead2="</div><div id=div_right_250 style='position:absolute; visibility: hidden; z-index:13;width: 250; height: 250' onMouseOut=bighide_right();><div align=right>"; document.write(adhead1 ad_80[ad_id] adhead2 ad_250[ad_id] "</div></div>"); myload() document.write ("</div>");
self.onError=null;
currentX_right = currentY_right = 0;
whichIt_right = null;
lastScrollX_right = 0; lastScrollY_right = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
function heartBeat_right() {

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:页面两侧对联广告(允许关闭)代码效果

下一篇:页面两侧对联广告代码效果