1、 JavaScript 自动弹出窗口并自动关闭窗口代码HTMLHEADTITLE 自动离开的窗口/TITLESCRIPT!-var flyingwinvar popupwidth=200var popupheight=150var marginrightvar windowcentervar i_top=200var i_left=-popupwidth-50var step=40var timervar waitingtime=5000var pause=20function showWindow() flyingwin = window.open(“, “flyingwin“, “tool
2、bar=no,width=“+popupwidth+“,height=“+popupheight+“,top=100,left=“+(-popupwidth)+“);flyingwin.document.open();flyingwin.document.write(“htmltitle 自动离开的窗口/titlebodyp align=center 请不要关闭,马上就离开:(/body/html“);flyingwin.document.close();if (document.all) marginright = screen.width+50if (document.layers) ma
3、rginright = screen.width+50windowcenter=Math.floor(marginright/2)-Math.floor(popupwidth/2)movewindow()function movewindow() if (i_left=windowcenter) flyingwin.moveTo(i_left,i_top)i_left+=steptimer= setTimeout(“movewindow()“,pause)else clearTimeout(timer)timer= setTimeout(“movewindow2()“,waitingtime)function movewindow2() if (i_left=marginright) flyingwin.moveTo(i_left,i_top)i_left+=steptimer= setTimeout(“movewindow2()“,pause)else clearTimeout(timer)flyingwin.close()/ -/SCRIPT/HEADBODY onload=showWindow() /BODY/HTML/td/tr/table