日期:2014-05-18  浏览次数:20997 次

Page.RegisterStartupScript("", "<script>window.showModalDialog(' 对象不支持此属性或方法
如题.
在一个未关闭的模态窗口A.aspx中,点击其中datagrid控件的itemcommand事件,又打开了一个模态窗口B.aspx.

代码如下:
if (cmd == "ZB")
  {
  this.Page.RegisterStartupScript("", "<script>window.showModalDialog('admin/ZB.aspx?MaxDateTime=" + e.Item.Cells[7].Text.Replace("'", "''").Trim() + "','','dialogheight:800px; dialogwidth:850px;center:yes; menubar:no;status:no;help:no;scroll:yes;resizable:no;location:no')<" + "/script>");
  }

运行的时候,在http://localhost/Info/下就可以弹出B.aspx.一切正常显示.

但是在域名状态下弹出B.aspx.就出错了.http://***.gicp.net/Info.

提示错误如下:
当前页的脚本发生错误。
行:130
字符:1
错误:对象不支持此属性或方法
URL:http://***.gicp.net/Info/A.aspx?name=%u5f18%u7855%u56ed



我的操作系统是2003的,在"Internet选项"中已经设置为安全为最低了,这是怎么回事呢.谢谢,在线等.

------解决方案--------------------
sf
------解决方案--------------------
Page.RegisterStartupScript("", " <script>window.showModalDialog('admin/ZB.aspx?MaxDateTime=" + e.Item.Cells[7].Text.Replace("'", "''").Trim() + "','','dialogheight:800px; dialogwidth:850px;center:yes; menubar:no;status:no;help:no;scroll:yes;resizable:no;location:no');</script>"); 

看看页面代码。使用不正确
------解决方案--------------------
探讨
Page.RegisterStartupScript("", " <script>window.showModalDialog('admin/ZB.aspx?MaxDateTime=" + e.Item.Cells[7].Text.Replace("'", "''").Trim() + "','','dialogheight:800px;  dialogwidth:850px;center:yes; menubar:no;status:no;help:no;scroll:yes;resizable:no;location:no'); </script>");

看看页面代码。使用不正确

------解决方案--------------------
看看路径有没有问题?IIS下跟VS自带的环境下有点区别!
------解决方案--------------------
用ClientScript.RegisterStartupScript注册脚本

asp.net中无限制弹出模态窗口
http://blog.csdn.net/manimanihome/archive/2009/08/29/4498331.aspx

------解决方案--------------------
在页面代码里使用windows.showModalDialog
或ClientScript.RegisterStartupScript
------解决方案--------------------
this.Page.RegisterStartupScript("", " <script>window.showModalDialog('admin/ZB.aspx?MaxDateTime=" + e.Item.Cells[7].Text.Replace("'", "''").Trim() + "','','dialogheight:800px; dialogwidth:850px;center:yes; ;status:no;help:no;scroll:yes;resizable:no') <" + "/script>");

//menubar:no;location:no好像无效的。
但是问题不应该在这里,问题出在打开的页面,是否页面有什么脚本试图打开窗口之类的脚本错误