Home > Web Front-end > JS Tutorial > body text

Advertising effect of moving in the web page mouseover_advertising code

WBOY
Release: 2016-05-16 19:26:52
Original
955 people have browsed it

[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]<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="Advertising effect of moving in the web page mouseover_advertising code" >'); nowads(); window.onresize=getClientSize; </script>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template