【发布时间】:2013-06-12 15:22:27
【问题描述】:
为什么在 IE8 中出现以下错误?它在 Chrome 中运行良好:
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.10.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#txtDate").datepicker({
changeMonth: true,
changeYear: true,
yearRange: "+0:+1",
showButtonPanel: false,
dateFormat: "dd/mm/yy",
showOn: "button",
buttonImage: "../../images/Calendar.png",
buttonImageOnly: true
});
});
</script>
所以在 Chrome 中绝对没有问题,但是 IE8 给了我以下错误:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; chromeframe/27.0.1453.110; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.0.3705; InfoPath.1; .NET4.0C; .NET4.0E)
Timestamp: Wed, 12 Jun 2013 15:18:48 UTC
Message: 'length' is null or not an object
Line: 139
Char: 17
Code: 0
URI: http://intranet/aspnet_client/system_web/1_1_4322/WebUIValidation.js
虽然日期选择器仍然有效,但当我单击图标时它会弹出,我可以选择一个日期,日期会出现在文本框中。但是当我点击日期时,日期选择器应该会消失,但它没有,而是显示上述错误。
有什么想法吗?
【问题讨论】:
-
你碰巧在使用 ASP..?
-
@AndrewPeacock,是的,更新了标签!
-
看来问题出在 ASP 上,而不是 JS。或者更确切地说,问题似乎出在您的 WebUIValidation.js 文件中。
-
正如其他人所说的 ASP.Net 客户端验证存在干扰,请尝试在页面加载时禁用所有验证器,并在提交按钮上启用所有验证器并触发它们进行客户端验证。跨度>
标签: jquery asp.net jquery-ui internet-explorer-8 .net-1.1