最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

showmodaldialog - Javascript error when attempting to open a modal window in a modal window - Stack Overflow

programmeradmin0浏览0评论

The application is running on a windows server 2003 box using asp 2.0 and is an IE specific web app. There is a button that opens a form in an iframe using showModalDialog(...) from a function call located in the JavaScript.

Here is an example of the function:

    function ShowBusinessHoursSubForm( source )
{
    var retval = window.showModalDialog("htm/" + locLocaleID + "/SubFormHostFrame.htm", source, "dialogWidth:265px;dialogHeight:261px;help:no;scroll:no;status:no;");

}

The host frame is loading an aspx page which contains the actual form that is being used. On the form that is opened there is a button that, when clicked, submits changed to the form. However, if no changed were made before the form was submitted, another modal window pops up stating that there were no changed to the form. This modal window is opened through registration of some JavaScript in the button click event. The code is as follows (C#):

string l_S_ErrorScript = "<script type='text/javascript' language='javascript'>window.showModalDialog('htm/" + l_S_Culture + "/NotChangedErrorDialog.htm', '../../" + l_S_SkinPath + "', 'dialogWidth:310px;dialogHeight:145px;scroll:no;help:no;status:no;');</script>";

if(!m_Page.ClientScript.IsStartupScriptRegistered("ErrorScript"))
        {
            m_Page.ClientScript.RegisterStartupScript(this.GetType(), "ErrorScript", l_S_ErrorScript);
        }

When the button is clicked and this dialog needs to appear the following JavaScript error appears:

Error: Object doesn't support this property or method

The weird thing is, if I access the application locally and try it everything works fine, but accessing from another puter causes the error. Also, depending on what server (we have many servers for testing all with windows server 2003) the error may not occur on another puter either. These puters are running the same software version using the same version of IE with the same settings. I'm inclined to believe that there is some configuration issue somewhere, but with the settings being the same it is hard to tell. I cannot really change how the app works or the technologies used either.

Anyone have any ideas as to what may be causing this?

The application is running on a windows server 2003 box using asp 2.0 and is an IE specific web app. There is a button that opens a form in an iframe using showModalDialog(...) from a function call located in the JavaScript.

Here is an example of the function:

    function ShowBusinessHoursSubForm( source )
{
    var retval = window.showModalDialog("htm/" + locLocaleID + "/SubFormHostFrame.htm", source, "dialogWidth:265px;dialogHeight:261px;help:no;scroll:no;status:no;");

}

The host frame is loading an aspx page which contains the actual form that is being used. On the form that is opened there is a button that, when clicked, submits changed to the form. However, if no changed were made before the form was submitted, another modal window pops up stating that there were no changed to the form. This modal window is opened through registration of some JavaScript in the button click event. The code is as follows (C#):

string l_S_ErrorScript = "<script type='text/javascript' language='javascript'>window.showModalDialog('htm/" + l_S_Culture + "/NotChangedErrorDialog.htm', '../../" + l_S_SkinPath + "', 'dialogWidth:310px;dialogHeight:145px;scroll:no;help:no;status:no;');</script>";

if(!m_Page.ClientScript.IsStartupScriptRegistered("ErrorScript"))
        {
            m_Page.ClientScript.RegisterStartupScript(this.GetType(), "ErrorScript", l_S_ErrorScript);
        }

When the button is clicked and this dialog needs to appear the following JavaScript error appears:

Error: Object doesn't support this property or method

The weird thing is, if I access the application locally and try it everything works fine, but accessing from another puter causes the error. Also, depending on what server (we have many servers for testing all with windows server 2003) the error may not occur on another puter either. These puters are running the same software version using the same version of IE with the same settings. I'm inclined to believe that there is some configuration issue somewhere, but with the settings being the same it is hard to tell. I cannot really change how the app works or the technologies used either.

Anyone have any ideas as to what may be causing this?

Share Improve this question edited Dec 8, 2013 at 15:50 BenMorel 36.6k51 gold badges205 silver badges336 bronze badges asked Apr 15, 2010 at 15:14 The Sheek GeekThe Sheek Geek 4,2166 gold badges41 silver badges49 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

The issue was with the popup blocker in IE on the client machine. Since the modal window was being opened in another modal window, the popup blocker did not consider it part of the parent and thinks it should block it. After adding the site to the popup blocker everything worked.

How ridiculous!

发布评论

评论列表(0)

  1. 暂无评论