Determine whether the browser supports ActiveX controls. If the browser supports ActiveX controls, what does window. ActiveXObject mean?
Solution: Determine whether the browser supports ActiveX controls. If the browser supports ActiveX controls, you can use
Var xml = new ActiveXObject ("Microsoft. XMLHTTP "); Create an XMLHttpRequest object (in versions earlier than IE7); in older IE versions, use var xml = new ActiveXObject (" Msxml2.XMLHTTP ") create an XMLHttpRequest object. In IE7 and non-ie browsers, you can use var xml = new XMLHttpRequest () to create an XMLHttpRequest object.
To create an XMLHttpRequest object, you must consider browser compatibility issues.
Create an XMLHTTPRequest object
By the way, let's take a look at how to declare (use) it. Before using the XMLHTTPRequest object to send requests and process responses, we must use javascript to create an XMLHTTPRequest object. (IE implements XMLHTTPRequest as an ActiveX object, while other browsers [such as Firefox/Safari/Opear] implement it as a local javascript Object ). Next let's take a look at how to use javascript to create it:
Code:
The Code is as follows: