日期:2014-05-17  浏览次数:20727 次

在页面中如何使用弹出窗

我用了好多方法想把页面FrmTrunShift给弹出,结果除了重定位(我不要重定位,我要弹出)之外都没有效果。求高手给个好方法,或看看是哪有问题。

{
                    //方法一:无反应
                    //Response.Write("<script laguage='javascript'>this.parent.document.location='FrmTrunShift.aspx'</script>");
                    //this.Page.Response.End();

                    //方法2:无反应
                    //Response.Write("<script laguage='javascript'>window.open('FrmTrunShift.aspx','newwindow','width=200,height=200')</script>");

                    //方法3:可跳转,但为 false时不可用
                    //Response.Redirect("FrmTrunShift.aspx", true);

                    //方法4:目前研究的,无反应
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "js", "OpenWindows();", true); 
                    
                    // 方法5:也是没反应
                    //window.showModalDialog(url,"查找", "resizable:no;scroll:yes;status:no;dialogWidth=420px;dialogHeight=330px;center=yes;help=no")
                    //Response.Write("<script laguage='javascript'>window.open('FrmTrunShift.aspx','查找', 'resizable:no;scroll:yes;status:no;dialogWidth=420px;dialogHeight=330px;center=yes;help=no')</script>");
                }


使用方法4的前台代码:
<script type="text/javascript" language="javascript">
       function OpenWindows() {
           //window.open('FrmTrunShift.aspx', 'newwindow', 'height=500,width=400,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no')
           //window.open('FrmTrunShift.aspx', 'newwindow', 'resizable:no;scroll:yes;status:no;dialogWidth=420px;dialogHeight=330px;center=yes;help=no');
            window.showModalDialog('FrmTrunShift.aspx', "查找", "resizable:no;scroll:yes;status:no;dialogWidth=420px;dialogHeight=330px;center=yes;help=no");
       }
   </script>

------解决方案--------------------
Response.Write("<script laguage='javascript'>window.open('FrmTrunShift.aspx','newwindow','width=200