<script language=javascript>
<!--
function GetSource( url, DestObj )
{
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
try
{
xmlhttp.onreadystatechange = function(){
if( xmlhttp.readyState == 4 )
{
if( xmlhttp.status == 200 )
{
DestObj.innerHTML = Bytes2BSTR( xmlhttp.responseBody );
if( xmlhttp.responseText == "" )
{
DestObj.innerText = "错误的服务";
}
}
else
{
DestObj.innerText = "由于网络状况导致服务失败";
}
}
else
{
DestObj.innerText = "服务加载中";
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
catch(ex)
{
DestObj.innerText = "加载错误!";
}
}
GetSource("weather.asp?id=" + Math.random(), document.getElementById("cnweather"));
//-->
</script>
<!--
function GetSource( url, DestObj )
{
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
try
{
xmlhttp.onreadystatechange = function(){
if( xmlhttp.readyState == 4 )
{
if( xmlhttp.status == 200 )
{
DestObj.innerHTML = Bytes2BSTR( xmlhttp.responseBody );
if( xmlhttp.responseText == "" )
{
DestObj.innerText = "错误的服务";
}
}
else
{
DestObj.innerText = "由于网络状况导致服务失败";
}
}
else
{
DestObj.innerText = "服务加载中";
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
catch(ex)
{
DestObj.innerText = "加载错误!";
}
}
GetSource("weather.asp?id=" + Math.random(), document.getElementById("cnweather"));
//-->
</script>
<script language=vbscript>
Function Bytes2BSTR( vIn )
Dim strReturn
Dim i
i = 0
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>
Function Bytes2BSTR( vIn )
Dim strReturn
Dim i
i = 0
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>