function openDoc()
{
    URL="page.php";
    myleft=(screen.availWidth-500)/2;
    mytop=150
    mywidth=550;
    myheight=420;
    if(confirm("really?"))
    { 
        window.open(URL,"page","height="+myheight+",width="+mywidth+",status=1,toolbar=no,
                    menubar=no,location=no,scrollbars=yes,top="+mytop+",left="+myleft+",resizable=yes");
    }
}如果没有if那个判断,可以跳出窗口
但有了confirm后,点确定没有反应

解决方案 »

  1.   

    window.open 别换行L@_@K
    [code=JScript]function openDoc() 

        URL="page.php"; 
        myleft=(screen.availWidth-500)/2; 
        mytop=150 
        mywidth=550; 
        myheight=420; 
        if(confirm("really?")) 
        { 
            window.open(URL,"page","height="+myheight+",width="+mywidth+",status=1,toolbar=no, menubar=no,location=no,scrollbars=yes,top="+mytop+",left="+myleft+",resizable=yes"); 
        } 
    } openDoc();[code]
      

  2.   

    ie8下测试可以的
    <script type="text/javascript">
    function openDoc() 

        URL="page.php"; 
        myleft=(screen.availWidth-500)/2; 
        mytop=150 
        mywidth=550; 
        myheight=420; 
        if(confirm("really?")) 
        { 
            window.open(URL,"page","height="+myheight+",width="+mywidth+",status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top="+mytop+",left="+myleft+",resizable=yes"); 
        } 
    } </script>
    <input type="button" value=" click" onclick="openDoc()"/>
      

  3.   


    我的ie6.0下面不可以,在firefox下面可以,请问有没有什么解决方法?
      

  4.   

    可以啊,我放到JSP中试了下,可以啊,
      

  5.   

    是中间换行(menubar之前)的问题引起的,删除以后我在MS IE6下测试可以"确定"后弹出窗口...window.open(URL,"page","height="+myheight+",width="+mywidth+",status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top="+mytop+",left="+myleft+",resizable=yes"); 
     
      

  6.   

    我试了一下,没有问题啊。
    function openDoc()
    {
        URL="http://www.google.com";
        myleft=(screen.availWidth-500)/2;
        mytop=150
        mywidth=550;
        myheight=420;
    alert(confirm("really?"));
        if(confirm("really?"))
        {
            window.open(URL,"page","height="+myheight+",width="+mywidth+",status=1,toolbar=no,\
                        menubar=no,location=no,scrollbars=yes,top="+mytop+",left="+myleft+",resizable=yes");
        }

    window.onload=openDoc;