ASP.NET Ajax In Action!读书笔记1
创建XMLHTTPRequest
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 var xmlHttp = null;
2 if (window.XMLHttpRequest) {
3 xmlHttp = new XMLHttpRequest(); //IE7,Firefox,opera
4 } else if (window.ActiveXObject) {
5 try
6 {
7 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");//IT6,IT5
8 }
9 catch(e){}
10
11 }
12
13
2 if (window.XMLHttpRequest) {
3 xmlHttp = new XMLHttpRequest(); //IE7,Firefox,opera
4 } else if (window.ActiveXObject) {
5 try
6 {
7 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");//IT6,IT5
8 }
9 catch(e){}
10
11 }
12
13