1<!-- 2//xmlhttpåxmldom对象 3var DedeXHTTP = null; 4var DedeXDOM = null; 5var DedeContainer = null; 6var DedeShowError = false; 7var DedeShowWait = false; 8var DedeErrCon = ""; 9var DedeErrDisplay = "ä¸è½½æ°æ®å¤±è´¥"; 10var DedeWaitDisplay = "æ£å¨ä¸è½½æ°æ®..."; 11 12//è·åæå®IDçå ç´ 13 14function $DE(id) { 15 return document.getElementById(id); 16} 17 18//gcontainer æ¯ä¿åä¸è½½å®æçå 容çå®¹å¨ 19//mShowError æ¯å¦æç¤ºéè¯¯ä¿¡æ¯ 20//DedeShowWait æ¯å¦æç¤ºçå¾ ä¿¡æ¯ 21//mErrCon æå¡å¨è¿åä»ä¹å符串è§ä¸ºé误 22//mErrDisplay åçéè¯¯æ¶æ¾ç¤ºçä¿¡æ¯ 23//mWaitDisplay çå¾ æ¶æç¤ºä¿¡æ¯ 24//é»è®¤è°ç¨ DedeAjax('divid',false,false,'','','') 25 26function DedeAjax(gcontainer,mShowError,mShowWait,mErrCon,mErrDisplay,mWaitDisplay) 27{ 28 29 DedeContainer = gcontainer; 30 DedeShowError = mShowError; 31 DedeShowWait = mShowWait; 32 if(mErrCon!="") DedeErrCon = mErrCon; 33 if(mErrDisplay!="") DedeErrDisplay = mErrDisplay; 34 if(mErrDisplay=="x") DedeErrDisplay = ""; 35 if(mWaitDisplay!="") DedeWaitDisplay = mWaitDisplay; 36 37 38 //postægetåéæ°æ®çé®å¼å¯¹ 39 this.keys = Array(); 40 this.values = Array(); 41 this.keyCount = -1; 42 this.sendlang = 'gb2312'; 43 44 //请æ±å¤´ç±»å 45 this.rtype = 'text'; 46 47 //åå§åxmlhttp 48 //IE6ãIE5 49 if(window.ActiveXObject) { 50 try { DedeXHTTP = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) { } 51 if (DedeXHTTP == null) try { DedeXHTTP = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) { } 52 } 53 else { 54 DedeXHTTP = new XMLHttpRequest(); 55 } 56 57 //å¢å ä¸ä¸ªPOSTæGETé®å¼å¯¹ 58 this.AddKeyN = function(skey,svalue) { 59 if(this.sendlang=='utf-8') this.AddKeyUtf8(skey, svalue); 60 else this.AddKey(skey, svalue); 61 }; 62 63 this.AddKey = function(skey,svalue) { 64 this.keyCount++; 65 this.keys[this.keyCount] = skey; 66 svalue = svalue+''; 67 if(svalue != '') svalue = svalue.replace(/\+/g,'$#$'); 68 this.values[this.keyCount] = escape(svalue); 69 }; 70 71 //å¢å ä¸ä¸ªPOSTæGETé®å¼å¯¹ 72 this.AddKeyUtf8 = function(skey,svalue) { 73 this.keyCount++; 74 this.keys[this.keyCount] = skey; 75 svalue = svalue+''; 76 if(svalue != '') svalue = svalue.replace(/\+/g,'$#$'); 77 this.values[this.keyCount] = encodeURI(svalue); 78 }; 79 80 //å¢å ä¸ä¸ªHttp请æ±å¤´é®å¼å¯¹ 81 this.AddHead = function(skey,svalue) { 82 this.rkeyCount++; 83 this.rkeys[this.rkeyCount] = skey; 84 this.rvalues[this.rkeyCount] = svalue; 85 }; 86 87 //æ¸ é¤å½å对象çåå¸è¡¨åæ° 88 this.ClearSet = function() { 89 this.keyCount = -1; 90 this.keys = Array(); 91 this.values = Array(); 92 this.rkeyCount = -1; 93 this.rkeys = Array(); 94 this.rvalues = Array(); 95 }; 96 97 98 DedeXHTTP.onreadystatechange = function() { 99 //å¨IE6ä¸ä¸ç®¡é»ææå¼æ¥æ¨¡å¼é½ä¼æ§è¡è¿ä¸ªäºä»¶ç 100 if(DedeXHTTP.readyState == 4){ 101 if(DedeXHTTP.status == 200) 102 { 103 if(DedeXHTTP.responseText!=DedeErrCon) { 104 DedeContainer.innerHTML = DedeXHTTP.responseText; 105 } 106 else { 107 if(DedeShowError) DedeContainer.innerHTML = DedeErrDisplay; 108 } 109 DedeXHTTP = null; 110 } 111 else { if(DedeShowError) DedeContainer.innerHTML = DedeErrDisplay; } 112 } 113 else { if(DedeShowWait) DedeContainer.innerHTML = DedeWaitDisplay; } 114 }; 115 116 //æ£æµé»ææ¨¡å¼çç¶æ 117 this.BarrageStat = function() { 118 if(DedeXHTTP==null) return; 119 if(typeof(DedeXHTTP.status)!=undefined && DedeXHTTP.status == 200) 120 { 121 if(DedeXHTTP.responseText!=DedeErrCon) { 122 DedeContainer.innerHTML = DedeXHTTP.responseText; 123 } 124 else { 125 if(DedeShowError) DedeContainer.innerHTML = DedeErrDisplay; 126 } 127 } 128 }; 129 130 //åéhttp请æ±å¤´ 131 this.SendHead = function() 132 { 133 //åéç¨æ·èªè¡è®¾å®ç请æ±å¤´ 134 if(this.rkeyCount!=-1) 135 { 136 for(var i = 0;i<=this.rkeyCount;i++) 137 { 138 DedeXHTTP.setRequestHeader(this.rkeys[i],this.rvalues[i]); 139 } 140 } 141 ãif(this.rtype=='binary'){ 142 ãDedeXHTTP.setRequestHeader("Content-Type","multipart/form-data"); 143 }else{ 144 DedeXHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 145 } 146}; 147 148//ç¨Postæ¹å¼åéæ°æ® 149this.SendPost = function(purl) { 150 var pdata = ""; 151 var i=0; 152 this.state = 0; 153 DedeXHTTP.open("POST", purl, true); 154 this.SendHead();
155 //postæ°æ® 156 if(this.keyCount!=-1) 157 { 158 for(;i<=this.keyCount;i++) 159 { 160 if(pdata=="") pdata = this.keys[i]+'='+this.values[i]; 161 else pdata += "&"+this.keys[i]+'='+this.values[i]; 162 } 163 } 164 DedeXHTTP.send(pdata); 165}; 166 167//ç¨GETæ¹å¼åéæ°æ® 168this.SendGet = function(purl) { 169 var gkey = ""; 170 var i=0; 171 this.state = 0; 172 //getåæ° 173 if(this.keyCount!=-1) 174 { 175 for(;i<=this.keyCount;i++) 176 { 177 if(gkey=="") gkey = this.keys[i]+'='+this.values[i]; 178 else gkey += "&"+this.keys[i]+'='+this.values[i]; 179 } 180 if(purl.indexOf('?')==-1) purl = purl + '?' + gkey; 181 else purl = purl + '&' + gkey; 182 } 183 DedeXHTTP.open("GET", purl, true); 184 this.SendHead(); 185 DedeXHTTP.send(null); 186}; 187 188//ç¨GETæ¹å¼åéæ°æ®ï¼é»å¡æ¨¡å¼ 189this.SendGet2 = function(purl) { 190 var gkey = ""; 191 var i=0; 192 this.state = 0; 193 //getåæ° 194 if(this.keyCount!=-1) 195 { 196 for(;i<=this.keyCount;i++) 197 { 198 if(gkey=="") gkey = this.keys[i]+'='+this.values[i]; 199 else gkey += "&"+this.keys[i]+'='+this.values[i]; 200 } 201 if(purl.indexOf('?')==-1) purl = purl + '?' + gkey; 202 else purl = purl + '&' + gkey; 203 } 204 DedeXHTTP.open("GET", purl, false); 205 this.SendHead(); 206 DedeXHTTP.send(null); 207 //firefoxä¸ç´æ¥æ£æµXHTTPç¶æ 208 this.BarrageStat(); 209}; 210 211//ç¨Postæ¹å¼åéæ°æ® 212this.SendPost2 = function(purl) { 213 var pdata = ""; 214 var i=0; 215 this.state = 0; 216 DedeXHTTP.open("POST", purl, false); 217 this.SendHead(); 218 //postæ°æ® 219 if(this.keyCount!=-1) 220 { 221 for(;i<=this.keyCount;i++) 222 { 223 if(pdata=="") pdata = this.keys[i]+'='+this.values[i]; 224 else pdata += "&"+this.keys[i]+'='+this.values[i]; 225 } 226 } 227 DedeXHTTP.send(pdata); 228 //firefoxä¸ç´æ¥æ£æµXHTTPç¶æ 229 this.BarrageStat(); 230}; 231 232 233} // End Class DedeAjax 234 235//åå§åxmldom 236function InitXDom() { 237 if(DedeXDOM!=null) return; 238 var obj = null; 239 // GeckoãMozillaãFirefox 240 if (typeof(DOMParser) != "undefined") { 241 var parser = new DOMParser(); 242 obj = parser.parseFromString(xmlText, "text/xml"); 243 } 244 // IE 245 else { 246 try { obj = new ActiveXObject("MSXML2.DOMDocument");} catch (e) { } 247 if (obj == null) try { obj = new ActiveXObject("Microsoft.XMLDOM"); } catch (e) { } 248 } 249 DedeXDOM = obj; 250}; 251 252 253 254//读åcookie彿° 255function GetCookie(c_name) 256{ 257 if (document.cookie.length > 0) 258 { 259 c_start = document.cookie.indexOf(c_name + "=") 260 if (c_start != -1) 261 { 262 c_start = c_start + c_name.length + 1; 263 c_end = document.cookie.indexOf(";",c_start); 264 if (c_end == -1) 265 { 266 c_end = document.cookie.length; 267 } 268 return unescape(document.cookie.substring(c_start,c_end)); 269 } 270 } 271 return null 272} 273 274function SetCookie(c_name,value,expiredays) 275{ 276 var exdate = new Date(); 277 exdate.setDate(exdate.getDate() + expiredays); 278 document.cookie = c_name + "=" +escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString()); //ä½¿è®¾ç½®çæææ¶é´æ£ç¡®ãå¢å toGMTString() 279} 280 281-->
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.