我正在ie9中开发我的ASP-MVC应用程序,当我加载第一个登录页面时,我收到此错误;
第6953行的未处理异常,第7列 ... /脚本/ jquery的-UI-1.10.0.js
0x800a138f - Microsoft JScript运行时错误:预期的对象
我查看了JQuery-ui-1.10.0.js文件,找到了这段代码;
_search: function( value ) {
this.pending++;
this.element.addClass( "ui-autocomplete-loading" );
this.cancelSearch = false;
this.source( { term: value }, this._response() );
},
我发现发生这种情况的原因是因为;
this.source is set to null.
但我无法找出原因以及解决方法。
我试图找到this.source的设置位置。 我在jquery-ui中找到了这段代码;
_initSource: function() {
var array, url,
that = this;
if ( $.isArray(this.options.source) ) {
array = this.options.source;
this.source = function( request, response ) {
response( $.ui.autocomplete.filter( array, request.term ) );
};
} else if ( typeof this.options.source === "string" ) {
url = this.options.source;
this.source = function( request, response ) {
if ( that.xhr ) {
that.xhr.abort();
}
that.xhr = $.ajax({
url: url,
data: request,
dataType: "json",
success: function( data ) {
response( data );
},
error: function() {
response( [] );
}
});
};
} else {
**this.source = this.options.source;**
}
我突出显示了执行的代码(即第3个分支)以及this.source设置为null的位置。 我没有能够追溯到这一点。
我的观点来源是;
<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]> <html class="no-js" lang="en"> <!--<![endif]-->
<html lang="en">
<head>
<meta charset="utf-8" />
<title>SCD</title>
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
<link rel="SHORTCUT ICON" href="/favicon.ico" />
<link href="/dataTables/css/AutoFill.css" rel="stylesheet"/>
<link href="/dataTables/css/demo_page.css" rel="stylesheet"/>
<link href="/dataTables/css/demo_table.css" rel="stylesheet"/>
<link href="/dataTables/css/demo_table_jui.css" rel="stylesheet"/>
<link href="/dataTables/css/jquery.dataTables.css" rel="stylesheet"/>
<link href="/dataTables/css/jquery.dataTables_themeroller.css" rel="stylesheet"/>
<link href="/dataTables/css/TableTools.css" rel="stylesheet"/>
<link href="/dataTables/css/TableTools_JUI.css" rel="stylesheet"/>
<link href="/Content/superfish.css" rel="stylesheet"/>
<link href="/Content/superfish-navbar.css" rel="stylesheet"/>
<link href="/Content/themes/sunny/jquery-ui.css" rel="stylesheet"/>
<link href="/Content/themes/sunny/jquery.ui.theme.css" rel="stylesheet"/>
<link href="/Content/demos.css" rel="stylesheet"/>
<link href="/Content/jquery.mobile-1.2.0.css" rel="stylesheet"/>
<link href="/Content/jquery.mobile.structure-1.2.0.css" rel="stylesheet"/>
<link href="/Content/jquery.mobile.theme-1.2.0.css" rel="stylesheet"/>
<link href="/Content/PagedList.css" rel="stylesheet"/>
<link href="/Content/css/bootstrap.css" rel="stylesheet"/>
<link href="/Content/css/bootstrap-responsive.css" rel="stylesheet"/>
<link href="/Content/Site.css" rel="stylesheet"/>
<link href="/Content/jquery.jqGrid/ui.jqgrid.css" rel="stylesheet"/>
<script src="/Scripts/modernizr-2.0.6-development-only.js"></script>
<script src="/Scripts/modernizr-2.6.2.js"></script>
</head>
<body>
<div class="page">
<section class="main-content">
<hgroup class="title">
<span style="margin-left:40px;"><h2>Log in.</h2></span>
</hgroup>
<section>
<form action="/" method="post"><input name="__RequestVerificationToken" type="hidden" value="I-FFb6bdAvkOOiAvXXU3kBC2f8ovY_xH2Y0tG4craWHUa6oVcHH-V6zi2kJy4luADvcRN6e_EC9vyIA8QnIWSnocZqnRFV79uVl_3s_BndjE_3R2P0MFJMpsLfA0yte4_N4hyNXQj3livH-2fNZGmKnZGQscE-Qj6GbSIRivn6A1" /> <div id="logon">
<fieldset>
<legend>Account Information</legend>
<div class="editor-label">
<label for="UserName">User name</label>
</div>
<div class="editor-field">
<input data-val="true" data-val-required="The User name field is required." id="UserName" name="UserName" type="text" value="geoffreypayne" />
<span class="field-validation-valid" data-valmsg-for="UserName" data-valmsg-replace="true"></span>
</div>
<div class="editor-label">
<label for="Password">Password</label>
</div>
<div class="editor-field">
<input data-val="true" data-val-required="The Password field is required." id="Password" name="Password" type="password" />
<span class="field-validation-valid" data-valmsg-for="Password" data-valmsg-replace="true"></span>
</div>
<div class="editor-label">
<input data-val="true" data-val-required="The Remember me? field is required." id="RememberMe" name="RememberMe" type="checkbox" value="true" /><input name="RememberMe" type="hidden" value="false" />
<label for="RememberMe">Remember me?</label>
</div>
<p>
<input type="submit" class="btnSubmit" value="Log On" />
</p>
</fieldset>
</div>
</form>
</div>
<script src="/Scripts/jquery-1.9.1.js"></script>
<script src="/Scripts/jquery-migrate-1.1.1.js"></script>
<script src="/Scripts/jquery-ui-1.10.4.js"></script>
<script src="/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="/Scripts/jquery.validate.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.js"></script>
<script src="/Scripts/jquery.calculation.js"></script>
<script src="/Scripts/jquery.columnizer.js"></script>
<script src="/Scripts/jquery.MultiFile.js"></script>
<script src="/Scripts/jquery.printElement.js"></script>
<script src="/Scripts/jquery.hotkeys.js"></script>
<script src="/Scripts/jquery.tablesorter.js"></script>
<script src="/Scripts/jquery.tablesorter.pager.js"></script>
<script src="/Scripts/bootstrap.js"></script>
<script src="/Scripts/scd.js"></script>
<script src="/Scripts/dataservice.js"></script>
<script src="/Scripts/popupservice.js"></script>
<script src="/Scripts/hoverIntent.js"></script>
<script src="/Scripts/superfish.js"></script>
<script src="/Scripts/supersubs.js"></script>
<script src="/Scripts/AjaxLogin.js"></script>
<script src="/Scripts/jqprint.js"></script>
<script src="/dataTables/Scripts/jquery.dataTables.js"></script>
<script src="/dataTables/Scripts/TableTools.js"></script>
<script src="/dataTables/Scripts/ZeroClipboard.js"></script>
<script src="/dataTables/Scripts/jquery.jeditable.js"></script>
<script src="/dataTables/Scripts/jquery.dataTables.editable.js"></script>
<script src="/Scripts/scd-basket.js"></script>
<script src="/Scripts/scd-search.js"></script>
<script src="/Scripts/scd-companyDetail.js"></script>
<script src="/Scripts/SCD/LogOn.js"></script>
<script src="/Scripts/CapsLock.compressed.js"></script>
</body>
</html>
答案 0 :(得分:2)
使用当前信息,我认为问题在于自动完成附加到每个输入标记,而不是所有输入标记都定义了。
可能的解决方案是将特定类添加到将托管自动完成fieldAutocomplete
的字段,然后使用限制性更强的选择器将自动完成仅附加到具有该类的元素。
像:
$( "input.fieldAutocomplete" ).autocomplete({
});