1 var request; 2 function getHTTPObject() { 3 //alert('here'); 4 //var request; 5 try { 6 request = new XMLHttpRequest(); 7 } catch (trymicrosoft) { 8 try { 9 request = new ActiveXObject("Msxml2.XMLHTTP"); 10 } catch (othermicrosoft) { 11 try { 12 request = new ActiveXObject("Microsoft.XMLHTTP"); 13 } catch (failed) { 14 request = false; 15 } 16 } 17 } 18 19 if (!request) 20 alert("Error initializing XMLHttpRequest!"); 21 //else 22 // alert("Request is "+request); 23 24 return request; 25 } 26 27 28 /* Function copied from http://www.webpasties.com/xmlHttpRequest/xmlHttpRequest_tutorial_1.html */ 29 function getHTTPObject_old() { 30 31 var xmlhttp; 32 33 /*@cc_on 34 35 @if (@_jscript_version >= 5) 36 37 try { 38 39 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 40 41 } catch (e) { 42 43 try { 44 45 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 46 47 } catch (E) { 48 49 xmlhttp = false; 50 51 } 52 53 } 54 55 @else 56 57 xmlhttp = false; 58 59 @end @*/ 60 61 if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { 62 63 try { 64 65 xmlhttp = new XMLHttpRequest(); 66 67 } catch (e) { 68 69 xmlhttp = false; 70 71 } 72 73 } 74 75 return xmlhttp; 76 77 } 78 79 80