复制代码 代码如下:
<script>
var xmlHttp;
var BrowerType="ie";
function createXML(){
try{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e){
try{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e2) {
xmlHttp =false;
}
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined'){
xmlHttp = new XMLHttpRequest();
BrowerType = "ff"; //用于记录是否火狐,以便下面处理接收中文数据分析使用。
}
}
function querytelcode(citys){
createXML();
showState=document.getElementById("showtelcode");
xmlHttp.onreadystatechange = function(){
if (xmlHttp.readyState == 2){
showState.innerHTML = '<img src="/img/process.gif" />';
}else if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
if (BrowerType=="ff"){
getLastCode=xmlHttp.responseText;//FireFox
}else{
getLastCode=gb2utf8(xmlHttp.responseBody);
}
showState.innerHTML = getLastCode;
}
}
var url='myorderAjax.asp?oid=<%=Request.QueryString("orderid")%>&cityname='+citys;
xmlHttp.open ("GET",url,true);
if (BrowerType=="ff"){
xmlHttp.overrideMimeType("text/html;charset=gb2312");//设定以gb2312编码识别数据,只有FF支持。IE不行
}
xmlHttp.send(null);
}
function gb2utf8(data){
var glbEncode = [];
gb2utf8_data = data;
execScript("gb2utf8_data = MidB(gb2utf8_data, 1)", "VBScript");
var t=escape(gb2utf8_data).replace(/%u/g,"").replace(/(.{2})(.{2})/g,"%$2%$1").replace(/%([A-Z].)%(.{2})/g,"@$1$2");
t=t.split("@");
var i=0,j=t.length,k;
while(++i<j) {
k=t[i].substring(0,4);
if(!glbEncode[k]) {
gb2utf8_char = eval("0x"+k);
execScript("gb2utf8_char = Chr(gb2utf8_char)", "VBScript");
glbEncode[k]=escape(gb2utf8_char).substring(1,6);
}
t[i]=glbEncode[k]+t[i].substring(4);
}
gb2utf8_data = gb2utf8_char = null;
return unescape(t.join("%"));
}
</script>
复制代码 代码如下:
xmlhttp = getXMLHttpRequest();
var url = "http://cn.astrology.yahoo.com/";;
xmlhttp.open("GET", url, true);
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4)
if (xmlhttp.status == 200)
alert(xmlhttp.responseText);
};
xmlhttp.send(null);
复制代码 代码如下:
xmlhttp = getXMLHttpRequest();
var url = "http://cn.astrology.yahoo.com/";;
xmlhttp.open("GET", url, true);
xmlhttp.overrideMimeType("text/html;charset=gb2312");//设定以gb2312编码识别数据
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4)
if (xmlhttp.status == 200)
alert(xmlhttp.responseText);
};
xmlhttp.send(null);
复制代码 代码如下:
function gb2utf8(data){
var glbEncode = [];
gb2utf8_data = data;
execScript("gb2utf8_data = MidB(gb2utf8_data, 1)", "VBScript");
var t=escape(gb2utf8_data).replace(/%u/g,"").replace(/(.{2})(.{2})/g,"%$2%$1").replace(/%([A-Z].)%(.{2})/g,"@$1$2");
t=t.split("@");
var i=0,j=t.length,k;
while(++i<j) {
k=t[i].substring(0,4);
if(!glbEncode[k]) {
gb2utf8_char = eval("0x"+k);
execScript("gb2utf8_char = Chr(gb2utf8_char)", "VBScript");
glbEncode[k]=escape(gb2utf8_char).substring(1,6);
}
t[i]=glbEncode[k]+t[i].substring(4);
}
gb2utf8_data = gb2utf8_char = null;
return unescape(t.join("%"));
}
xmlhttp = getXMLHttpRequest();
var url = "http://cn.astrology.yahoo.com/";;
xmlhttp.open("GET", url, true);
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4)
if (xmlhttp.status == 200)
alert(gb2utf8(xmlhttp.responseBody)); //注意这里要用responseBody
};
xmlhttp.send(null);
新闻热点
疑难解答
图片精选