-//W3C//DTD HTML 4.0 Transitional//EN”>
Function bytes2BSTR(vIn)
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
Function viewSource1()
dim XmlHttp
set XmlHttp = CreateObject(“Microsoft.XMLHTTP”)
XmlHttp.Open “GET”, document.location.href, false
XmlHttp.setRequestHeader “Content-Type”,”text/XML”
XmlHttp.Send
dim html
html = bytes2BSTR(XmlHttp.responseBody)
msgbox html
End Function
Function viewSource2()
dim XmlHttp
set XmlHttp = CreateObject(“Microsoft.XMLHTTP”)
XmlHttp.Open “GET”, “http://www.google.com”, false
XmlHttp.setRequestHeader “Content-Type”,”text/XML”
XmlHttp.Send
dim html
html = bytes2BSTR(XmlHttp.responseBody)
msgbox html
End Function
XMLHTTP Get HTML页面时的中文乱码之完全客户端Script解决方案 |
查看自身的网页代码 |
查看google主页代码 |