>웹 프론트엔드 >JS 튜토리얼 >웹페이지 이동에 따른 광고효과 mouseover_advertising code

웹페이지 이동에 따른 광고효과 mouseover_advertising code

WBOY
WBOY원래의
2016-05-16 19:26:52970검색

[Ctrl A 모두 선택 참고: 외부 J를 도입해야 하는 경우 실행하려면 새로 고쳐야 합니다
]<script> //init cookie function setCookie() { var FromUrl=window.location.toString(); FromUrl=FromUrl.replace("http://",""); FromUrl=FromUrl.replace("www.",""); FromUrl=FromUrl.substring(0,FromUrl.indexOf("/")); var now=new Date(); //set cookie expires date 1000ms*60*60 now.setTime( now.getTime() + 1000 * 60 * 60 ); var the_cookie = "FromUrl="+FromUrl+";expires="+now.toGMTString()+";path=/"; document.cookie = the_cookie;//write Cookie } function readCookie() { var the_cookie = document.cookie; return the_cookie; } setCookie(); //end of init cookie var brOK=false; var mie=false; var vmin=2; var vmax=5; var vr=3; var timer1; var nowads; var ad_width=0; var ad_height=0; // <a href="http://www.now.net.cn">Domain Hosting email <a href="http://www.todayisp.com">Domain Hosting email function movechip(chipname) { if(brOK) { eval("chip="+chipname); if(!mie) { pageX=window.pageXOffset; pageW=window.innerWidth; pageY=window.pageYOffset; pageH=window.innerHeight; } else { pageX=window.document.body.scrollLeft; pageW=window.document.body.offsetWidth-8; pageY=window.document.body.scrollTop; pageH=window.document.body.offsetHeight; } chip.xx=chip.xx+chip.vx; chip.yy=chip.yy+chip.vy; chip.vx+=vr*(Math.random()-0.5); chip.vy+=vr*(Math.random()-0.5); if(chip.vx>(vmax+vmin)) chip.vx=(vmax+vmin)*2-chip.vx; if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx; if(chip.vy>(vmax+vmin)) chip.vy=(vmax+vmin)*2-chip.vy; if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy; if(chip.xx<=pageX) { chip.xx=pageX; chip.vx=vmin+vmax*Math.random(); } if(chip.xx>=pageX+pageW-chip.w) { chip.xx=pageX+pageW-chip.w; chip.vx=-vmin-vmax*Math.random(); } if(chip.xx>=pageW-ad_width) { chip.xx=chip.xx-20; chip.vx=-vmin-vmax*Math.random(); } if(chip.yy<=pageY) { chip.yy=pageY; chip.vy=vmin+vmax*Math.random(); } if(chip.yy>=pageY+pageH-ad_height) { chip.yy=pageY+pageH-ad_height; chip.vy=-vmin-vmax*Math.random(); } if(!mie) { eval('document.'+chip.named+'.top ='+chip.yy); eval('document.'+chip.named+'.left='+chip.xx); } else { eval('document.all.'+chip.named+'.style.pixelLeft='+chip.xx); eval('document.all.'+chip.named+'.style.pixelTop ='+chip.yy); } chip.timer1=setTimeout("movechip('"+chip.named+"')",80); } } function stopme(chipname) { if(brOK) { eval("chip="+chipname); if(chip.timer1!=null) { clearTimeout(chip.timer1) } } } function nowads() { if(navigator.appName.indexOf("Internet Explorer")!=-1) { if(parseInt(navigator.appVersion.substring(0,1))>=4) brOK=navigator.javaEnabled();mie=true; } if(navigator.appName.indexOf("Netscape")!=-1) { if(parseInt(navigator.appVersion.substring(0,1))>=4) brOK=navigator.javaEnabled(); } nowads.named="nowads"; nowads.vx=vmin+vmax*Math.random(); nowads.vy=vmin+vmax*Math.random(); nowads.w=1; nowads.h=1; nowads.xx=0; nowads.yy=0; ad_width=nowads_img.width; ad_height=nowads_img.height; //alert(ad_height); nowads.timer1=null; movechip("nowads"); } function getClientSize() { pageW=window.document.body.offsetWidth-8; pageH=window.document.body.offsetHeight; } document.write('<span id="nowads" style="height:49px;left:178px;position:absolute;top:1237px;width:70px; z-index:100000">'); document.write('<a href="http://www.jb51.net/" target="_blank" onmouseover=stopme("nowads"); onmouseout=movechip("nowads");>'); document.write('<img id="nowads_img" src="http://www.jb51.net/logos.gif" style="max-width:90%"0" alt="웹페이지 이동에 따른 광고효과 mouseover_advertising code" >'); nowads(); window.onresize=getClientSize; </script>
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.