Uncaught TypeError: Object # has no method 'load'
當Javascript載入XML檔案時,IE和FF下正常,但Chrome下報錯:Uncaught TypeError: Object #<Document> has no method 'load' ,這是因為Chrome瀏覽器沒有實現XMLdocument.load方法,你可以換成XmlHttpRequest
var xmlDoc = "";
try{ //Internet Explorer
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.load(file);
}catch(e){
try{ //Firefox, Mozilla, Opera, etc.
xmlDoc=document.implementation.createDocument("","",null);
xmlDoc.async=false;
xmlDoc.load(file);
}catch(e){
try{ //Google Chrome
var xmlhttp = new window.XMLHttpRequest();
xmlhttp.open("GET",file,false);
xmlhttp.send(null);
xmlDoc = xmlhttp.responseXML.documentElement;
}catch(e){
error=e.message;
}
}
}
相關文章
- Uncaught TypeError: Object [object Object] has no method 'xxx'ErrorObject
- Uncaught TypeError: $(...).attr(...) is undefinedErrorUndefined
- Uncaught TypeError: i is not a functionErrorFunction
- TypeError: object() takes no parametersErrorObject
- echarts:Uncaught TypeError: Cannot read property '0' of undefinedEchartsErrorUndefined
- Uncaught TypeError: external_echarts_.helper.createTextStyle is not a functionat Object.seriesModel.layoutInstance.ondraw問題的解決ErrorEchartsFunctionObject
- js 函式報錯“Uncaught: TypeError xxx is not a function”JS函式ErrorFunction
- Uncaught SyntaxError: Identifier 'Geometry' has already been declaredErrorIDE
- react 和redux整合報TypeError: Object(...) is not a functionReactReduxErrorObjectFunction
- TypeError: Object of type ‘datetime‘ is not JSON serializableErrorObjectJSON
- AttributeError: 'dict' object has no attribute 'has_key'ErrorObject
- jquery-3.4.1.js:10091 Uncaught TypeError: url.indexOf is not a functionjQueryJSErrorIndexFunction
- Process object has no attribute '_popen'Object
- ‘dict‘ object has no attribute ‘iteritems‘Object
- Ajax 報錯jquery-3.3.1.min.js:2 Uncaught TypeError: Cannot use 'in' operator to seajQueryJSError
- Django程式碼中的TypeError 'float' object is not callableDjangoErrorObject
- 1.python報錯:TypeError: 'int' object is not subscriptablePythonErrorObject
- ‘FirewallD‘ object has no attribute ‘path‘ 、‘fw‘、is not registeredObject
- AttributeError: 'module' object has no attribute 'lock'ErrorObject
- python報錯:TypeError: slice indices must be integers or None or have an __index__ methodPythonErrorNoneIndex
- Python報錯:TypeError: a bytes-like object is required, not ‘str‘PythonErrorObjectUI
- 【坑】Tkinter ‘NoneType‘ object has no attribute ‘destroy‘NoneObject
- AttributeError: 'Settings' object has no attribute 'HBase'ErrorObject
- MIT6.0001 筆記,LECTURE 8:Object Oriented Programming (class,object,method)MIT筆記Object
- Method has too many Body parameters: public abstract com.cloud.module.smartkeCloud
- zt_powerdesigner_'find in diagram' 後彈出'the object has no symbol'ObjectSymbol
- Invalid configuration object webpack dev server has been initialisedObjectWebdevServer
- labelme2coco問題:TypeError: Object of type 'int64' is not JSON serializableErrorObjectJSON
- 問題解決:AttributeError: ‘NoneType‘ object has no attribute ‘append‘ErrorNoneObjectAPP
- rust-quiz:010-shadowed-trait-object-method.rsRustUIAIObject
- Non-static method 'save(java.long.Object)' cannot be referenced from a static context.JavaObjectContext
- Python:Python3錯誤提示TypeError: slice indices must be integers or None or have an __index__ method解決辦法PythonErrorNoneIndex
- python去掉excel空格和換行,報錯'int' object has no attribute 'strip'PythonExcelObject
- Rasa init報錯:AttributeError: type object 'Callable' has no attribute '_abc_registry'ErrorObject
- Traceback (most recent call last): File "AttributeError: 'NoneType' object has no attribute 'group'ASTErrorNoneObject
- TypeError: “ModelBase is not iterable”Error
- TypeError: SizeOnlySource is not a constructorErrorStruct
- Syntax Error: ValidationError: Invalid options object. Stylus Loader has been initialized using anErrorObjectZed