iPad Safari 模态弹出窗口问题

7
我正在开发一个与iPad兼容的Web应用程序。
过去我在iOS 3.2版本上进行测试时,所有模态对话框弹出窗口都能够正常地将值返回给父窗口。但是升级到iOS 4.3后,它的行为变得奇怪了。现在,在iPad上,它会返回一个值,但是直到我点击另一个字段或同一个字段(HTML文本字段)之后,它才更新该字段。
我使用window.open()来打开模态弹出窗口,并使用window.opener.oaEventiPad(retValArray)来返回。oaEventiPad是负责设置更新值的函数。
请问是否有人能帮忙?
谢谢。

请多发一些你的代码,谢谢。 - tim peterson
你能发布带有oaEventiPad()函数的代码吗?这将有助于我们更好地理解。 - CaptainBli
1个回答

0

我遇到了类似的问题。在我的asp .net应用程序中,我使用window.open打开一个弹出窗口,该应用程序应与iPad兼容。当我在Windows 7的PC上使用IE、Chrome、FireFox和Safari时,成功返回了值。

不幸的是,在通过iPad访问应用程序时,相同的代码在Safari中失败。在新窗口打开时,domObject被提示,而不是在新窗口关闭时提示返回的值。

以下是代码。 父窗口:

enter code here


<script type="text/javascript">

        function modalWin() {
            //alert('clicked');
            if (window.showModalDialog) {
                retVal = window.showModalDialog("About.aspx", "name", "dialogWidth:255px;dialogHeight:250px");
                alert(retVal);
            }
            else {
                retVal = window.open('About.aspx', 'name', 'height=255,width=250,toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no ,modal=yes');
                alert(retVal);
            }

        }
    </script>
//HTML
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<a title="Test New Popup" onclick="modalWin();">New Popup for all browsers.</a>.
</asp:Content>

新页面:

     <script type="text/javascript">
        function closeIt(tempValue) {
            window.returnValue = tempValue;
            window.close();
        }
    </script>
//HTML:
 <input id="btnButton1" value="btnButton1" type="button" title="Press it to Close" onclick="closeIt('btnButton1');" />
    <br />
    <input id="btnButton2" value="btnButton2" type="button" title="Press it to Close" onclick="closeIt('btnButton2');" />
    <br />
    <input id="btnButton3" value="btnButton3" type="button" title="Press it to Close" onclick="closeIt('btnButton3');" />

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接