JavaScript automatically pops up window and closes window code automatically
<HTML>
<HEAD>
<TITLE> automatically exit window </TITLE>
<SCRIPT>
<! --
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= 5000
Var pause = 20
Function showWindow (){
Flyingwin = window. open ("", "flyingwin", "toolbar = no, width =" + popupwidth + ", height =" + popupheight + ", top = 100, left = "+ (-popupwidth) + "");
Flyingwin.doc ument. open ();
Flyingwin.doc ument. write ("
Flyingwin.doc ument. 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>
<BODY onload = showWindow ()> </BODY>
</HTML> </td>
</Tr>
</Table>