이 기사는 웹 페이지의 오른쪽 상단에서 미끄러 져 큰 광고를 자동으로 사라지는 JS 방법을 보여줍니다. 참조를 위해 공유하십시오. 특정 구현 방법은 다음과 같습니다.
코드를 다음과 같이 복사하십시오.
<html xmlns = "http://www.w3.org/1999/xhtml">
<헤드>
<title> JS 웹 페이지의 오른쪽 상단이 스 와이프 될 때 자동으로 사라지는 큰 광고 효과 </title>
<meta http-equiv = "content-type"content = "text/html; charset = gb2312">
<!-<head>와 </head>-> 사이에 다음 코드를 추가하십시오
<script type = "text/javaScript"언어 = "javaScript">
var time = 500;
var w = 0;
함수 addCount ()
{
if (time> 0)
{
시간--;
w = w+5;
}
또 다른
{
반품;
}
if (w> 278) // 너비
{
반품;
}
document.getElementById ( "ads"). style.display = "";
document.getElementById ( "ads"). style.width = w+"px";
settimeout ( "addcount ()", 30);
}
Window.onload = function showads ()
{
addCount ();
settimeout ( "noneads ()", 3000); // danting time
}
</스크립트>
<script type = "text/javaScript"언어 = "javaScript">
var t = 198;
var n = 188; // 높이
기능 noneads ()
{
if (t> 0)
{
티--;
n = n-5;
}
또 다른
{
반품;
}
if (n <0)
{
document.getElementById ( "ads"). Style.Display = "none";
반품;
}
document.getElementById ( "ads"). style.width = n+"px";
settimeout ( "noneads ()", 30);
}
</스크립트>
</head>
<body>
<!-<body>와 </body>-> 사이에 다음 코드를 추가하십시오
<div id = "ads"style = "margin : auto; display : none; 위치 : 절대; 너비 : 200px; 상단 : 0px; 오른쪽 : 0; 높이 : 200px; 배경 색 :#d5282e; 오버플로 : 텍스트-정렬 : 센터;"> <p align = "center"> wulin.com </a> hectorations for and onector for and then </p>
</div>
</body>
</html>
이 기사가 모든 사람의 JavaScript 프로그래밍에 도움이되기를 바랍니다.