文章搜索 

关键字:

相关文章 

没有相关文章。

GOOGLE 广告

Js+Xml:不刷新页面获取对应网址的网页中内容并显示(支持中文)


<INPUT TYPE="text" NAME="url"><INPUT TYPE="button" onclick=get() value=get>
<div id=yyyy style='width:400;height:500;border:5px'></div>

<script language="vbscript">
function bytes2BSTR(vIn)
dim strReturn,i,ThisCharCode,innerCode,Hight8,Low8,NextCharCode
strReturn=""
for i=1 to LenB(vIn)
ThisCharCode=AscB(MidB(vIn,i,1))
if ThisCharCode<&H80 Then
strReturn=strReturn & Chr(ThisCharCode)
else
NextCharCode=AscB(MidB(vIn,i+1,1))
strReturn=strReturn&Chr(CLng(ThisCharCode)*&H100+CInt(NextCharCode))
i=i+1
end if
next
bytes2BSTR=strReturn
end function
</script>
<script language="JScript">
function get(){
var xmlhttp=new ActiveXObject("Msxml2.xmlhttp")
xmlhttp.open("GET",url.value,false)
xmlhttp.send()
var str = bytes2BSTR(xmlhttp.ResponseBody)

yyyy.innerHTML=str;
}
</script>