다음과 같이 코드 코드를 복사합니다.
<!DOCTYPE HTML>
<html>
<머리>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JS 전체 화면 플로팅 광고</title>
<스타일 유형="텍스트/css">
div#roll{너비:100px;높이:100px; 배경색:#000; 위치:절대;}
</style>
</head>
<본문>
<div>
<div><h2>JS 전체 화면 플로팅 광고, 커서를 움직여 움직임을 멈추세요・Ke Leyi</h2></div>
</div>
<div id="roll">광고 중입니다<br />www.jb51.com</div>
<스크립트 유형="텍스트/자바스크립트">
var ggRoll = {
롤: document.getElementById("롤"),
속도: 20,
상태X: 1,
상태Y: 1,
x: 100,
y: 300,
winW: document.documentElement.clientWidth - document.getElementById("roll").offsetWidth,
winH: document.documentElement.clientHeight - document.getElementById("roll").offsetHeight,
이동: 함수 () {
this.roll.style.left = this.x + 'px';
this.roll.style.top = this.y + 'px';
this.x = this.x + (this.statusX ? -1 : 1)
if (this.x < 0) { this.statusX = 0 }
if (this.x > this.winW) { this.statusX = 1 }
this.y = this.y + (this.statusY ? -1 : 1)
if (this.y < 0) { this.statusY = 0 }
if (this.y > this.winH) { this.statusY = 1 }
}
}
var 간격 = setInterval("ggRoll.Go()", ggRoll.speed);
ggRoll.roll.onmouseover = function () {clearInterval(interval) };
ggRoll.roll.onmouseout = function () { 간격 = setInterval("ggRoll.Go()", ggRoll.speed) };
</script>
</body>
</html>