select聚焦并阻止iPhone 5上的进一步执行

select focusses and blocks further execution on iPhone 5

本文关键字:进一步 执行 iPhone 聚焦 select      更新时间:2023-09-26

在Jquery Mobile应用程序中,我遇到了一个仅在iPhone 5设备上发生的问题。其他iPhone版本(至少5以上)和所有其他平台都没有问题。在一个页面里,我有一个对话框。对话框中有几个选项。单击"确定"按钮或"取消"按钮(tsBtnOK,tsBtnCancel)时,选择宽度id"transJobType"将进入焦点并等待用户选择,执行将停止。tbBtnOK的代码从未执行过。如果没有在tsBtnOK上运行的代码,也会发生同样的情况。

我试过:

  • 数据菜单本机错误/正确无差异
  • 数据阻止焦点缩放,假/真无差异
  • 编码焦点到tsBtnOK,没有区别

记住,这只发生在iPhone 5平台上,但在我测试过的所有(3+)iPhone 5设备上都是一致的。

当"transWorkTypeDiv"answers"transDescriptionDiv"这两个面板被隐藏时,它似乎可以工作,因为选择仍然很快显示,但tsBtnOK上的代码会被执行,完成后对话框会关闭。

请注意,标记是ASPX页面的一部分,因此<%=GetLocalResourceObject…>标签

任何提示或想法都将不胜感激

<div data-role="popup" id="tsTransDialog" data-overlay-theme="a" data-transition="flip" data-position-to="window" data-theme="<%=global_asax.JQMTheme%>" class="ui-corner-all">
            <div data-role="header" data-theme="a" class="ui-corner-top">
                <h1><%=GetLocalResourceObject("TimesheetTransDiaHeader") %></h1>
            </div>
            <div data-role="content" data-theme="d" class="ui-corner-bottom ui-content">
                <div id="tsTransDialogFields">
                    <div id="divWorkSelect" class="jobOnly ui-field-contain">
                        <label for="transJobType"><%=GetLocalResourceObject("TimesheetJobType") %></label>
                        <select name="transJobType" data-mini="true" data-native-menu="true" data-prevent-focus-zoom="true" onchange="tsOpenJobPicker();" id="transJobType">
                        </select>
                    </div>
                    <div class="jobOnly" data-role="fieldcontain">
                        <label for="transJobNo"><%=GetLocalResourceObject("TimesheetJobNo") %></label>
                        <div>
                            <input type="text" data-inline="true" id="transJobNo" placeholder="<%=GetLocalResourceObject("TimesheetExampleJobNo") %>" />
                            <div style="position: absolute; top: 25px; right: -4px">
                                <a href="javascript:tsOpenJobPicker();" data-role="button" data-inline="true" data-mini="true" data-iconpos="notext" data-icon="search"></a>
                            </div>
                        </div>
                    </div>
                    <div id="transStartTimeDiv" data-role="fieldcontain">
                        <label for="transStartTime"><%=GetLocalResourceObject("TimesheetStartTime") %></label>
                        <input type="text" data-inline="true" id="transStartTime" placeholder="<%=GetLocalResourceObject("TimesheetExampleTime") %>13:05" />
                    </div>
                    <div id="transStopTimeDiv" data-role="fieldcontain">
                        <label for="transStopTime"><%=GetLocalResourceObject("TimesheetStopTime") %></label>
                        <input type="text" data-inline="true" id="transStopTime" placeholder="<%=GetLocalResourceObject("TimesheetExampleTime") %>14:55" />
                    </div>
                    <div id="transHoursDiv" data-role="fieldcontain">
                        <label for="transHours"><%=GetLocalResourceObject("TimesheetHours") %></label>
                        <input type="text" data-inline="true" id="transHours" placeholder="<%=GetLocalResourceObject("TimesheetExampleTime") %> 2,5" />
                    </div>
                    <div id="transWorkTypeDiv" data-role="fieldcontain">
                        <label for="selectTransWorkType"><%=GetLocalResourceObject("TimesheetWorkType") %></label>
                        <select name="selectTransWorkType" data-mini="true" data-native-menu="true" data-prevent-focus-zoom="true"  id="selectTransWorkType"></select>
                    </div>
                    <div id="transDescriptionDiv">
                        <div id="transDescriptionDiv1" data-role="fieldcontain">
                            <label for="transDescription1"><%=GetLocalResourceObject("TimesheetTransDescription1") %></label>
                            <input type="text" data-inline="true" data-mini="true" id="transDescription1" name="transDescription1" />
                        </div>
                        <div id="transDescriptionDiv2" data-role="fieldcontain">
                            <label for="transDescription2"><%=GetLocalResourceObject("TimesheetTransDescription2") %></label>
                            <input type="text" data-inline="true" data-mini="true" id="transDescription2" name="transDescription2" />
                        </div>
                    </div>
                </div>
                <a id="tsBtnOK" href="javascript:tsTransInsert();" data-role="button" data-mini="true" data-inline="true" data-theme="<%=global_asax.JQMTheme%>"><%=GetLocalResourceObject("TimesheetTransUpdate") %></a>
                <a id="tsBtnCancel" href="#" data-role="button" data-rel="back" data-mini="true" data-inline="true" data-theme="<%=global_asax.JQMTheme%>"><%=GetLocalResourceObject("Cancel") %></a>
            </div>
        </div>

终于找到了解决方案,这绝非逻辑,但我会回答我自己的问题,以防其他人发现自己也处于同样的情况,并在这个问题上绊倒。我将对话框tsTransDialog作为共享对话框移动到页面外部,并在启动时启动它。它使问题消失了。