Ajax XmlHttpRequest 创建

 1 <script type="text/javascript">
 2             function createXHR(){
 3                 var xhr = null;
 4                 try {
 5                     // Firefox, Opera 8.0+, Safari,IE7+
 6                     xhr = new XMLHttpRequest();
 7                 }
 8                 catch (e) {
 9                     // Internet Explorer 
10                     try {
11                         xhr = new ActiveXObject("Msxml2.XMLHTTP");
12                     }
13                     catch (e) {
14                         try {
15                             xhr = new ActiveXObject("Microsoft.XMLHTTP");
16                         }
17                         catch (e) {
18                             xhr = null;
19                         }
20                     }
21                 }
22                 return xhr;
23             }
24</script>

 

相关文章:

  • 2021-06-21
  • 2021-12-16
  • 2021-08-02
  • 2022-12-23
  • 2021-10-31
  • 2021-08-02
  • 2021-09-21
  • 2022-12-23
猜你喜欢
  • 2021-09-20
  • 2022-01-20
  • 2021-10-29
  • 2021-06-10
  • 2021-08-29
相关资源
相似解决方案