我在 Internet Explorer 中运行我的项目时遇到了一些问题。一切都在Chrome中运行良好,但是当我在IE中启动它时,我收到以下错误消息。
Unhandled exception at line 2525, column 4 in http://localhost:52288/Scripts/jquery-1.8.3.js
0x80020003 - JavaScript runtime error: Member not found.
我显然在jquery-1.8.3.js的某个地方遇到了问题,但我对此相当陌生,不知道从哪里开始。有人可以指出我正确的方向吗?这是它失败的函数。
if ( !getSetAttribute ) {
fixSpecified = {
name: true,
id: true,
coords: true
};
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ?
ret.value :
undefined;
},
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
ret = document.createAttribute( name );
elem.setAttributeNode( ret );
}
// FAILING ON THIS LINE
return ( ret.value = value + "" ); // <--- ?
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
get: nodeHook.get,
set: function( elem, value, name ) {
if ( value === "" ) {
value = "false";
}
nodeHook.set( elem, value, name );
}
};
}
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret === null ? undefined : ret;
}
});
});
}
我刚刚遇到了一个似乎有效的解决方案。我在 _Layout.cshtml 的标签中添加了以下行。
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" />
这是我遇到解决方案的地方:
http://twigstechtips.blogspot.com/2010/03/css-ie8-meta-tag-to-disable.html
这是 IE10 兼容模式下的已知错误。 请参阅错误 #12577
这也有一个微软连接错误,但微软关闭了它,因为不会在IE10中修复。
这也是一个可能的重复问题 jquery-script3-member-not-found,但我没有足够的代表来标记它。