複製程式碼 程式碼如下: 🎜> JS全螢幕漂浮廣告 <BR>div#roll{width:100px;height:100px; background-color:#000; color:#fff; position:absolute;} JS全螢幕漂浮廣告,移入遊標停止移動·柯樂義 我是廣告www.jb51.com <BR>var ggRoll = {<BR>roll: document .getElementById("roll"),<BR>speed: 20,<BR>statusX: 1,<BR>statusY: 1,<BR>x: 100,<BR>y: 300,<BR>x: 100,<BR>y: 300,<BR>winW: document. documentElement.clientWidth - document.getElementById("roll").offsetWidth,winH: document.documentElement.clientHeight - document.getElementById("roll").offsetHeight,<P>Go: function ( .roll.style.left = this.x 'px';<BR>this.roll.style.top = this.y 'px';<BR> this.x = this.x (this.statusX ? -1 : 1)<P>if (this.x < 0) { this.statusX = 0 }<BR>if (this.x > this.winW ) { this.statusX = 1 }<BR> <BR>this.y = this.y (this.statusY ? -1 : 1)<BR>if (this.y < 0) { this.statusY = 0 }<BR>if (this.y > this.winH ) { this.statusY = 1 }<BR>}<BR>}<BR>var interval = setInterval("ggRoll.Go()", ggRoll.speed);<BR>ggRoll.roll.onmouseover = function () { clearInterval(interval) };<BR>ggRoll.roll.onmouseout = function () { interval = setInterval("ggRoll.Go()", ggRoll.speed) };<BR>