In development, friends who often need to use Ajax technology should have met a situation recently, which was originally developed in IE6 EnvironmentProgramIn IE7, there are hundreds of errors, either the object is invalid or the object does not support this method. In fact, this is because IE7 has more Native XMLHttp Support than IE6. There are two solutions:
1. click "Tools"-> "Internet Options"-> "advanced" and find "Enable Native XMLHttp Support" under the "Security" node. This option is checked by default, disable it to solve the problem.
2. Add judgment before creating the XMLHTTPRequest object in javascript:
If (window. activexobject ){
Req = new activexobject ("Microsoft. XMLHTTP ");
} Else if (window. activexobject ){
Req = new activexobject ("msxml2.xmlhttp. 4.0 ");
} Else if (window. activexobject ){
Req = new activexobject ("msxml2.xmlhttp ");
} Else if (window. XMLHttpRequest ){
Req = new XMLHttpRequest ();
}
Tip: You need to put window. XMLHttpRequest In the last item to solve the compatibility problem.
This allows the program to run normally on IE 6, IE7, and other browsers.