window.open时,如果浏览器设置为多标签,新开的窗口为标签时,就会变成标签了。不是我想要的效果,我想要的效果是类似于alert()这种,弹出窗口在当前页面上,是一个小窗口请问有什么办法可以实现,谢谢!!

解决方案 »

  1.   


    /*
    Winopen 使用说明:弹出页必须加<base target="_self">,否则提交时会弹出新窗口
    最好也加入:
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">
    否则页面被缓存会造成更改页面后不能显示为最新的
    Parameter详解:
    1.   dialogHeight:   对话框高度,不小于100px
    2.   dialogWidth:   对话框宽度。
    3.   dialogLeft:    离屏幕左的距离。
    4.   dialogTop:    离屏幕上的距离。
    5.   center:  { yes | no | 1 | 0 } : 是否居中,默认yes,但仍可以指定高度和宽度。
    6.   help: {yes | no | 1 | 0 }:      是否显示帮助按钮,默认yes。
    7.   resizable:  {yes | no | 1 | 0 } [IE5+]:    是否可被改变大小。默认no。
    8.   status:{yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[ Modeless]或no[Modal]。
    9.   scroll:{ yes | no | 1 | 0 | on | off }:是否显示滚动条。默认为yes。
    示例:WinOpen('test.html','test','dialogHeight:300px;dialogWidth:200px;help:no;status:no;')
    */
    function Winopen(PageUrl,title,parameter)
    {
    var sRet = window.showModalDialog(PageUrl,title,parameter);
    if(sRet == "refresh")
    {window.location.reload();}
    }
    参考下,怎么用当中有
      

  2.   

    showModalDialog倒是可以,但是它老是弹出
    “该页包含未知的潜在安全隐患,是否继续?”
      

  3.   

    测试代码:
    <script>
    function Winopen(PageUrl,title,parameter)
        {
            var sRet = window.showModalDialog(PageUrl,title,parameter);
            if(sRet == "refresh")
            {window.location.reload();}
        }
    </script>
    <input type="button" onclick="WinOpen('welcome.html','test','dialogHeight:300px;dialogWidth:200px;help:no;status:no;')">点击时报错:缺少对象
      

  4.   

    <div id="box" style="position:absolute;left:0;top:0;width:300px;height:200px;"></div><script>
    var id = document.getElementById('box');
    var Width = document.documentElement.clientWidth ;
    var Height = document.documentElement.clientHeight ;
    var selfW = id.style.width ;
    var selfH = id.style.height ;
    id.style.left = (Width-selfW)/2+"px";
    id.style.top = (Height-selfH)/2+"px";
    </script>绝对居中显示
      

  5.   

    WinOpen和window.showModalDialog都可以,只是后者传值时稍微有点麻烦
      

  6.   

    IE-->Internet选项-->更改网页选项卡方式-->始终已新窗口打开
      

  7.   

    WinOpen和window.showModalDialog都可以,只是后者传值时稍微有点麻烦