我转换后老是出错,谁帮忙看下。 下面这个是源程序,可以正常运行的。<%
function getHTTPPage(url)
dim Http
set Http=server.createobject("MSXML2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate <>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number <>0 then err.Clear
end function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Dim Url,Html
Url="http://192.168.0.95/testlist.asp"
Html = getHTTPPage(Url)
Response.write Html
%> 我想把上面的程序修改成下面这样的脚本, <HTML>
<head>
<title>无刷新演示 </title> <script language="javascript">
function GetData()
{
url="testlist.asp";//调用页面 var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open("GET",url,false);
http.send();
var str = http.responseText;
loadcontent.innerHTML=str;
setTimeout("GetData()",1000);
}
</script> </head>
<BODY onload="javascript:GetData();">
<span id="loadcontent">数据载入中…… </span>
</BODY>
</HTML>
function getHTTPPage(url)
dim Http
set Http=server.createobject("MSXML2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate <>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number <>0 then err.Clear
end function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Dim Url,Html
Url="http://192.168.0.95/testlist.asp"
Html = getHTTPPage(Url)
Response.write Html
%> 我想把上面的程序修改成下面这样的脚本, <HTML>
<head>
<title>无刷新演示 </title> <script language="javascript">
function GetData()
{
url="testlist.asp";//调用页面 var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open("GET",url,false);
http.send();
var str = http.responseText;
loadcontent.innerHTML=str;
setTimeout("GetData()",1000);
}
</script> </head>
<BODY onload="javascript:GetData();">
<span id="loadcontent">数据载入中…… </span>
</BODY>
</HTML>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货