<html>
<head><title>bytes2text</title></head>
<body>
<div id="text1">解码用时:</div>
<script language="vbscript">
Function jsMidB(str, p)
jsMidB = MidB(str, p)
End Function
Function jsChr(ascii)
jsChr = Chr(ascii)
End Function
</script>
<script language="javascript">
function xmlHttp(sendMethod, url, postData)
{
var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open(sendMethod, url, false, null, null);
if(sendMethod == "post"){
http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
http.send(postData);
}
else{
http.send(null)
}
return http;
}
function bs2str(str)
{
if(!bs2str.ss) bs2str.ss = [];
return unescape(escape(jsMidb(str,1)).replace(/.{2}(.{2})(.{2})/g, "%$2%$1").replace(/%([^0-7].).(.{2})/g, function(a,a1,a2){var s=a1+a2;if(!bs2str.ss[s]) bs2str.ss[s]=jsChr(eval("0x"+s));return bs2str.ss[s];}));
}
//测试
var http = xmlHttp("get", "http://bbs.blueidea.com", "");
var data = http.responseBody;
t = (new Date()).getTime();
var html = bs2str(data);
document.getElementById("text1").innerText += (new Date()).getTime() - t;
document.getElementById("text1").innerText += "\r\n" + html;
</script>
</body>
</html>
posted on 2006-10-24 16:16
汪杰 阅读(284)
评论(0) 编辑 收藏 引用 所属分类:
ajax