0

我在 iPad(iOS 7.0.3)上的 Chrome(版本 30.0.1599.16)上遇到了一个小错误。我有一个带有登录控件的 aspx 页面,它呈现以下 HTML 代码:

头部脚本

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>

控件

<td align="right">
  <label for="UserName">User Name:</label>
</td>
<td>
  <input name="lgnBlock$UserName" type="text" id="UserName" />
  <span id="UserNameRequired" title="User Name is required." style="visibility:hidden;">*</span>
</td>

底部脚本

<script type="text/javascript">
//<![CDATA[
var Page_Validators =  new Array(document.getElementById("UserNameRequired"), document.getElementById("PasswordRequired"));
//]]>
</script>

<script type="text/javascript">
//<![CDATA[
var UserNameRequired = document.all ? document.all["UserNameRequired"] : document.getElementById("UserNameRequired");
UserNameRequired.controltovalidate = "UserName";
UserNameRequired.errormessage = "User Name is required.";
UserNameRequired.validationGroup = "lgnBlock";
UserNameRequired.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
UserNameRequired.initialvalue = "";
var PasswordRequired = document.all ? document.all["PasswordRequired"] : document.getElementById("PasswordRequired");
PasswordRequired.controltovalidate = "Password";
PasswordRequired.errormessage = "Password is required.";
PasswordRequired.validationGroup = "lgnBlock";
PasswordRequired.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
PasswordRequired.initialvalue = "";
//]]>
</script>


<script type="text/javascript">
//<![CDATA[

var Page_ValidationActive = false;
if (typeof(ValidatorOnLoad) == "function") {
    ValidatorOnLoad();
}

function ValidatorOnSubmit() {
    if (Page_ValidationActive) {
        return ValidatorCommonOnSubmit();
    }
    else {
        return true;
    }
}
        //]]>
</script>

当我点击用户名文本框输入名称时,屏幕键盘会出现,但控件失去焦点,我必须再次点击才能填写它。这不会发生在我的 iPad 上的 Safari 上。我发现了这个类似的问题,但报告为解决方案的答案不适合我的情况。

有什么建议么?

ps 带有验证功能的 javascript 是登录控件的一部分

4

0 回答 0