1 <script type="text/javascript"> 2 var agt = navigator.userAgent.toLowerCase(); 3 var is_op = (agt.indexOf("opera") != -1); 4 var is_ie = (agt.indexOf("msie") != -1) && document.all && !is_op; 5 var is_ie5 = (agt.indexOf("msie 5") != -1) && document.all && !is_op; 6 7 function CreateXmlHttpReq(handler) { 8 var xmlhttp = null; 9 if (is_ie) { 10 var control = (is_ie5) ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP"; 11 try { 12 xmlhttp = new ActiveXObject(control); 13 xmlhttp.onreadystatechange = handler; 14 } catch (ex) { 15 alert("You need to enable active scripting and activeX controls"); 16 } 17 18 } else { 19 xmlhttp = new XMLHttpRequest(); 20 xmlhttp.onload = handler; 21 xmlhttp.onerror = handler; 22 } 23 return xmlhttp; 24 } 25 26 27 function XmlHttpPOST(xmlhttp, url, data) { 28 try { 29 xmlhttp.open("POST", url, true); 30 xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); 31 xmlhttp.send(data); 32 33 } catch (ex) { 34 &nb[1] [2] [3] [4] [5] [6] [7] 下一页 |