自动溜走的窗口

http://www.tuqiu.com/main.show.php?flag=%B4%B0%BF%DA%CC%D8%D0%A7&idnum=317&page=1

<SCRIPT>
<!--

var flyingwin
//窗口高度
var popupwidth=300
//窗口宽度
var popupheight=250
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.document.open();
flyingwin.document.write("<html><title>漂浮的窗口</title><body background=http://www.tuqiu.com/img/bg.jpg text=#006600><p align=center><br><font size='+1' color=red><b>欢迎来到土丘网络,</b></font><br><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()
}
}

// -->
showWindow();
</SCRIPT>

posted on 2005-07-17 19:06  cy163  阅读(186)  评论(0编辑  收藏  举报

导航