Advertisement effect in Webpage moving move cursor _ advertisement code

Source: Internet
Author: User
Tags set cookie domain hosting vmin
Hover the mouse over the advertisement effect in the webpage

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 1000 ms * 60*60 now. setTime (now. getTime () + 1000*60*60); var the_cookie = "FromUrl =" + FromUrl + "; expires =" + now. toGMTString () + "; path =/"; e Nt. 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; // 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.doc ument. body. scrollLeft; pagew1_1_doc ument. body. offsetWidth-8; pageydomaindetail Doc ument. body. scrollTop; pageh1_1_doc ument. 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 (c Hip. 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 () {pagew1_1_1_doc ument. body. offsetWidth-8; pagehw.domaindoc ument. body. offsetHeight;} document. write (''); document. write (''); document. write (''); nowads (); window. onresize = getClientSize; script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.