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: $(...).attr(...) is undefinedErrorUndefined
- Uncaught TypeError: i is not a functionErrorFunction
- Uncaught TypeError: external_echarts_.helper.createTextStyle is not a functionat Object.seriesModel.layoutInstance.ondraw問題的解決ErrorEchartsFunctionObject
- echarts:Uncaught TypeError: Cannot read property '0' of undefinedEchartsErrorUndefined
- TypeError: object() takes no parametersErrorObject
- Uncaught SyntaxError: Identifier 'Geometry' has already been declaredErrorIDE
- TypeError: Object of type ‘datetime‘ is not JSON serializableErrorObjectJSON
- jquery-3.4.1.js:10091 Uncaught TypeError: url.indexOf is not a functionjQueryJSErrorIndexFunction
- ‘dict‘ object has no attribute ‘iteritems‘Object
- Process object has no attribute '_popen'Object
- pytorch 踩坑,TypeError: expected seqence object with len>_0 or a single integer_typeerror: expected sequence object with len __ 0PyTorchErrorObject
- AttributeError: 'Settings' object has no attribute 'HBase'ErrorObject
- react 和redux整合報TypeError: Object(...) is not a functionReactReduxErrorObjectFunction
- 【坑】Tkinter ‘NoneType‘ object has no attribute ‘destroy‘NoneObject
- ‘FirewallD‘ object has no attribute ‘path‘ 、‘fw‘、is not registeredObject
- Django程式碼中的TypeError 'float' object is not callableDjangoErrorObject
- 1.python報錯:TypeError: 'int' object is not subscriptablePythonErrorObject
- MIT6.0001 筆記,LECTURE 8:Object Oriented Programming (class,object,method)MIT筆記Object
- Ajax 報錯jquery-3.3.1.min.js:2 Uncaught TypeError: Cannot use 'in' operator to seajQueryJSError
- Python報錯:TypeError: a bytes-like object is required, not ‘str‘PythonErrorObjectUI
- python報錯:TypeError: slice indices must be integers or None or have an __index__ methodPythonErrorNoneIndex
- rust-quiz:010-shadowed-trait-object-method.rsRustUIAIObject
- 問題解決:AttributeError: ‘NoneType‘ object has no attribute ‘append‘ErrorNoneObjectAPP
- TypeError: Cannot read private member xxx from an object whose class did not declare itErrorObject
- Method has too many Body parameters: public abstract com.cloud.module.smartkeCloud
- Traceback (most recent call last): File "AttributeError: 'NoneType' object has no attribute 'group'ASTErrorNoneObject
- labelme2coco問題:TypeError: Object of type 'int64' is not JSON serializableErrorObjectJSON
- Rasa init報錯:AttributeError: type object 'Callable' has no attribute '_abc_registry'ErrorObject
- Syntax Error: ValidationError: Invalid options object. Stylus Loader has been initialized using anErrorObjectZed
- python去掉excel空格和換行,報錯'int' object has no attribute 'strip'PythonExcelObject
- 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
- 1_使用face_recognition模組:錯誤AttributeError:'PngStream' object has no attribute 'chunk fcWp'(20190223)ErrorObject
- TypeError: stringWidth is not a functionErrorFunction
- TypeError: SizeOnlySource is not a constructorErrorStruct
- TypeError: “ModelBase is not iterable”Error
- Uncaught Error: Cannot instantiate interfaceError
- Uncaught SyntaxError: Unexpected token <反思Error
- Numerical Results of RhDYas CG method and RhLHas CG method