不行。但是可以判断这个窗口显示了多久,如果不到时间就被关闭,则在open()一次。
不过用户会厌烦的。

解决方案 »

  1.   

    不要让客户做不到自己想做的事,更不要强迫别人看不想看的东西 !给你段代码,希望对你有用!
    <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=20function 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> 
    <BODY onload=showWindow()></BODY>