인터넷정보

공지창이 왼쪽에서 오른쪽으로 휘~~~리~~~릭~~~

알 수 없는 사용자 2007. 10. 17. 13:37
http://oxtag.com/html/ex/popup1.html

 


소스를 잘 보시고 사용하세영!!

<script>
<!-- Beginning of JavaScript -

var flyingwin
var popupwidth=200
var popupheight=150
var marginright
var windowcenter
var i_top=200
var i_left=-popupwidth-50
var step=40
var timer
var waitingtime=3000
var pause=20

function showWindow() {
 flyingwin = window.open("", "flyingwin", "toolbar=no,width="+popupwidth+",height="+popupheight+",top=100,left="+(-popupwidth)+"");
 flyingwin.document.open();
 flyingwin.document.write("<html><title>
여기에 제목<\/title>
<body bgcolor='FF0000' text=FFFFFF><p align=center><br><font size='+1'><b>
여기에 주제!</b></font><br>여기에 내용을 적으세요.</p><\/body><\/html>");
 flyingwin.document.close();
 
 if (document.all) {
  marginright = screen.width+50
 }
 if (document.layers) {
  marginright = screen.width+50
 }
 windowcenter=Math.floor(marginright/2)-Math.floor(popupwidth/2)
 movewindow()
 
}

function movewindow() {
  if (i_left<=windowcenter) {
   flyingwin.moveTo(i_left,i_top)
   i_left+=step
   timer= setTimeout("movewindow()",pause)
  }
  else {
   clearTimeout(timer)
   timer= setTimeout("movewindow2()",waitingtime)
  }
}

function movewindow2() {
  if (i_left<=marginright) {
   flyingwin.moveTo(i_left,i_top)
   i_left+=step
   timer= setTimeout("movewindow2()",pause)
  }
  else {
   clearTimeout(timer)
   flyingwin.close()
  }
}

// -->
</script>
여기까지가 head 안에 들어감
</head>

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red" onload="showWindow()">


반응형