作为新页面打开,然后设置setTime控制关闭

解决方案 »

  1.   

    用showModalDialog + setTimeout(),那个图片显示不出来,你把alert()的那个叹号抓下来就行了test.htm
    ========================================
    <html>
    <head>
    <title> New Document </title>
    <script language="javascript">
    /*************************************************
    功能:可以自己定制的comfirm提示框,在IE6下测试通过
    **************************************************//**
    参数说明: strTitle confirm框的标题
    strMessage confirm框要显示的消息
    intWidth confirm框的宽度
    intHeight  confirm框的高度*/
    function myConfirm(strTitle,strMessage,intType,intWidth,intHeight)
    {
    var strDialogFeatures = "status=no;center=yes;help=no;dialogWidth="+intWidth+";dialogHeight="+intHeight+";scroll=yes;resize=no";
    var args = new Array();
    args[args.length] = strTitle;
    args[args.length] = strMessage;
    args[args.length] = intType;
    var result = showModalDialog("myConfirm.htm",args,strDialogFeatures);
    return result;
    }
    function test()
    {
    var myConfirmResult = myConfirm("这里是标题","aaa",2,12,7)}
    </script>
    </head><body>
    <input type="button" value="点我试试" onclick="test()">
    <br>
    <br>
    </html>
    myConfirm.htm
    ========================
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <script language="javascript">
    <!--
    var args = window.dialogArguments
    try{
    document.title = args[0]; //设置标题
    }catch(e)
    {
    //这里屏蔽了错误,防止万一调用的传递参数不足
    }//-->
    </script>
    <title></title>
    <style type="text/css">
    <!--
    body {
    margin-left: 0px;
    margin-top: 0px;
    background-color: menu;
    overflow: hidden;
    overflow-x:hidden;
        overflow-y:hidden;
    }
    -->
    </style>
    <script language="javascript">
    function init()
    {
    setTimeout("window.close()",1000)
    var args = window.dialogArguments
    try{
    message.innerHTML = args[1]; //设置提示的信息
    }catch(e)
    {
    //这里屏蔽了错误,防止万一调用的传递参数不足
    }
    ok.attachEvent("onclick",okClick); //设置YES按钮的事件处理函数
    }
    function okClick()//YES按钮的事件处理函数
    {
      window.close();
    }
    window.attachEvent("onload",init)
    </script>
    </head>
    <body>
    <table width="100%"  border="0" cellspacing="5">
      <tr>
        <td><div align="center">
          <img src="images/ico.gif" width="33" height="32"> </div></td>
        <td><div align="left" id="message"></div></td>
      </tr>
      <tr>
        <td colspan="2">
          <div align="center">
            <input name="ok" type="button" id="ok" value="  确定  ">    
            </div></td>
      </tr>
    </table>
    </body>
    </html>
      

  2.   

    alert("")不能自动关闭吧.
    你可以自己用层模拟.
    然后,在setInerval来控制其可见性.
      

  3.   

    同意 wanghr100(灰豆宝宝.net)
      

  4.   

    我觉得可以这样,在alert("");后用javascript模拟按下回车健
    new ActiveXObject('Wscript.Shell')).SendKeys('{回车}')可以结合setTimeout
      

  5.   

    那你自己模拟一个小的探出窗体好了,做个小的页面
    ----------------aaaaaa.html------------------------------------
    这是一个弹出窗体自动关闭的程序
    <script language="javascript">
    aa = window.open("","_black", "width=200,height=100,top=200,left=300");
    aa.document.write("<body bgcolor='gray'><h4>hello world!</h4><center><input type='button' value=' 确 认 ' onclick='window.close()'></center></body>");
    setTimeout("aa.close()", 2000);
    </script>
      

  6.   

    alert窗口在网页中是无法自动关闭的,wscript
    宿主脚本只能用在本机,可以采用大家所说的方法,模式窗比较适合
      

  7.   

    弹出alert框,一秒后自动关闭<br/><script language="JavaScript">
    var aaa
    function test()
    {
    aaa=if0.showModelessDialog("javascript:alert();window.close();","","status:no;resizable:no;help:no;dialogHeight:30px;dialogWidth:40px;");
    setTimeout("if0.location.reload();",1000);}
    </script>
    <iframe style="display:none" name=if0 ></iframe>
    <input type="button"  value="弹出alert框,一秒后自动关闭;" onClick="JavaScript:test()">
    </form>参考JK_10000(JK)
      

  8.   

    <html>
    <body>
    <script language="JavaScript">
    function test()
    {
    showModelessDialog("javascript:alert();window.close();","","status:no;resizable:no;help:no;dialogHeight:30px;dialogWidth:40px;");
    setTimeout("location.reload();",1000);}
    </script>
    </body>
    <input type="button"  value="弹出alert框,一秒后自动关闭;" onClick="JavaScript:test()">
    </html>