今天是

爱酷家


当前位置:首页 > 资源收藏 > 特效代码

自己显示并关闭的窗口

收集整理   发布时间:2012-11-16 20:53:00   阅读

自己显示并关闭的窗口

代码:
<HTML>
<HEAD><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.document.open();
	flyingwin.document.write("<html><title>自动离开的窗口</title><body><p align=center>请不要关闭,我马上就自动滚蛋:(</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> 
<META name="GENERATOR" content="IBM HomePage Builder 2001 V5.0.0 for Windows">
<TITLE></TITLE>
</HEAD>
<BODY onload=showWindow()> </BODY>
</HTML>

 

 



注:⊙如转载本站原创作品,请务必包保留本文地址:

内容: