现在很多网站广告做的如火如荼现在我就来介绍一下常见的对联浮动广告效果的代码使用方法本文介绍的这种效果在*分辨率下正常显示在*的分辨率下可以自动隐藏以免遮住页面影响访问者浏览内容而且与前面一个代码不同的是当鼠标移动到广告图片上是可以感应显示另外设置好的广告大图效果下面文本框中就是实现效果所需代码 function bigshow(){documentalldiv_stylevisibility = visible; documentalldiv_stylevisibility = hidden; } function bighide(){ documentalldiv_stylevisibility = visible; documentalldiv_stylevisibility = hidden; } var ad_= new Array(); var ad_= new Array(); ad_[]=<a href= target=_blank><img src=/img/js_gif border=></a>; ad_[]=<a href= target=_blank><img src=/img/js_gif border=></a>; var imgheight; var fubioleft; windowscreenwidth> ? fubioleft=:fubioleft= documentwrite(<DIV id=floater_left >); ad_now = new Date(); ad_id= ad_nowgetSeconds() % var adhead=<div id=div_ style=position:absolute; width:px; height:px; zindex: onMouseOver=bigshow();>; var adhead=</div><div id=div_ style=position:absolute; visibility: hidden; zindex:;width: ; height: onMouseOut=bighide();>; documentwrite(adhead+ad_[ad_id]+adhead+ad_[ad_id]+</div>); documentwrite (</div>); selfonError=null; currentX = currentY = ; whichIt = null; lastScrollX = ; lastScrollY = ; NS = (documentlayers) ? : ; IE = (documentall) ? : ; function heartBeat() { if(IE) { diffY = documentbodyscrollTop; diffX = documentbodyscrollLeft; } if(NS) { diffY = selfpageYOffset; diffX = selfpageXOffset; } if(diffY != lastScrollY) { percent = * (diffY lastScrollY); if(percent > ) percent = Mathceil(percent); else percent = Mathfloor(percent); if(IE) documentallfloater_leftstylepixelTop += percent; if(NS) documentfloater_lefttop += percent; lastScrollY = lastScrollY + percent; } if(diffX != lastScrollX) { percent = * (diffX lastScrollX); if(percent > ) percent = Mathceil(percent); else percent = Mathfloor(percent); if(IE) documentallfloater_leftstylepixelLeft += percent; if(NS) documentfloater_leftleft += percent; lastScrollX = lastScrollX + percent; } } if(NS || IE) action = windowsetInterval(heartBeat());var ad_= new Array(); var ad_= new Array(); ad_[]=<a href= target=_blank><img src=/img/js_gif border=></a>; ad_[]=<a href= target=_blank><img src=/img/js_gif border=></a>; var imgheight; var fubioleft; windowscreenwidth> ? fubioleft=:fubioleft= documentwrite(<DIV id=floater_right >); ad_now = new Date(); ad_id= ad_nowgetSeconds() % function myload() { if (navigatorappName == Netscape) { documentdiv_right_pageX=+windowinnerWidth; documentdiv_right_pageX=+windowinnerWidth; mymove(); } else { div_right_styleleft=documentbodyoffsetWidth; div_right_styleleft=documentbodyoffsetWidth; mymove(); } } function mymove() { if(documentns) { documentdiv_right_left=pageXOffset+windowinnerWidth; documentdiv_right_left=pageXOffset+windowinnerWidth; setTimeout(mymove();) } else { div_right_styleleft=documentbodyscrollLeft+documentbodyoffsetWidth; div_right_styleleft=documentbodyscrollLeft+documentbodyoffsetWidth; setTimeout(mymove();) } } var adhead=<div id=div_right_ style=position:absolute; width:px; height:px; zindex: onMouseOver=bigshow_right();>; var adhead=</div><div id=div_right_ style=position:absolute; visibility: hidden; zindex:;width: ; height: onMouseOut=bighide_right();><div align=right>; documentwrite(adhead+ad_[ad_id]+adhead+ad_[ad_id]+</div></div>); myload() documentwrite (</div>); selfonError=null; currentX_right = currentY_right = ; whichIt_right = null; lastScrollX_right = ; lastScrollY_right = ; NS = (documentlayers) ? : ; IE = (documentall) ? : ; function heartBeat_right() { if(IE) { diffY_right = documentbodyscrollTop; diffX_right = documentbodyscrollLeft; } if(NS) { diffY_right = selfpageYOffset; diffX_right = selfpageXOffset; } if(diffY_right != lastScrollY_right) { percent_right = * (diffY_right lastScrollY_right); if(percent_right > ) percent_right = Mathceil(percent_right); else percent_right = Mathfloor(percent_right); if(IE) documentallfloater_rightstylepixelTop += percent_right; if(NS) documentfloater_righttop += percent_right; lastScrollY_right = lastScrollY_right + percent_right; } if(diffX_right != lastScrollX_right) { percent_right = * (diffX_right lastScrollX_right); if(percent_right > ) percent_right = Mathceil(percent_right); else percent_right = Mathfloor(percent_right); if(IE) documentallfloater_rightstylepixelLeft += percent_right; if(NS) documentfloater_rightleft += percent_right; lastScrollX_right = lastScrollX_right + percent_right; } } if(NS || IE) action = windowsetInterval(heartBeat_right()); function bigshow_right(){ documentalldiv_right_stylevisibility = visible; documentalldiv_right_stylevisibility = hidden; } function bighide_right(){ documentalldiv_right_stylevisibility = visible; documentalldiv_right_stylevisibility = hidden; }documentwrite(); documentwrite(); documentwrite(); 把上面的代码另存为一个JS文件然后在想实现此效果的页面用<script type=text/javascript language=javascript src=*js></SCRIPT>调用即可*代表你另存的文件名!注意修改广告图片地址和连接地址! |