会自动消失的窗口
演示效果:
代码提示:按下面的说明修改并复制代码
一:将下面的代码放在<HEAD>与</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 background=http://www.tastelife.net/images/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() } } // --> </SCRIPT> 二:修改<body***>中的内容,将下面的代码加入原<body***>中 onload=showWindow() 三:将下面的代码复制到〈BODY〉区 <input name="B1" onclick="showWindow()" type="button" value="点击这里看看">
本站浏览量: