关于XMLHTTP的问题?

var XH = new ActiveXObject ("Microsoft.XMLHTTP");
XH.Open("get", "link_select_get.php?depart="+val, false);
XH.Send("");
alert(XH.responseText);

为什么取出的中文都是乱码?(我已经在前面加上meta标记控制charset)
---------------------------------------------------------------

 1<script>   
 2<!--   
 3function getXML(URL) {   
 4var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");   
 5xmlhttp.Open("GET",URL, false);   
 6xmlhttp.Send("");   
 7var result = bytes2BSTR(xmlhttp.responseBody);   
 8return result;   
 9}   
10//-->   
11</script>
 1<script language="vbscript">   
 2Function bytes2BSTR(vIn)   
 3  
 4Dim strReturn,i,ThisCharCode,innerCode,Hight8,Low8,NextCharCode   
 5strReturn = ""   
 6  
 7For i = 1 To LenB(vIn)   
 8ThisCharCode = AscB(MidB(vIn,i,1))   
 9If ThisCharCode < &H80 Then   
10strReturn = strReturn & Chr(ThisCharCode)   
11Else   
12NextCharCode = AscB(MidB(vIn,i+1,1))   
13strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))   
14i = i + 1   
15End If   
16Next   
17  
18bytes2BSTR = strReturn   
19  
20End Function   
21</script>
1<button onclick='alert(getXML("http://www.5inet.net/article/xml/1024.xml"))'>获取xml</button>

---------------------------------------------------------------

http://www.csdn.net/expert/topic/749/749358.xml?temp=.3731348
---------------------------------------------------------------

try

alert(XH.responseBody);

Published At
Categories with Web编程
comments powered by Disqus