请高手帮忙指点
这是AGENT的代码:
Sub Initialize
Print |Content-type:text/xml|
Print |<?xml version="1.0" encoding="GB2312"?>|
Print |<div>China</div>|
End Sub
这是在JAVASCRIPT程序:
function login()
{
if (document.all("username").value=="")
{
alert("ERROR.Please input your username!");
document.all("username").focus;
exit;
}
if (document.all("password").value=="")
{
alert("ERROR,Please input your password!");
exit;
}
var xDoc=new ActiveXObject("Microsoft.XMLDOM");
xDoc.async=false;
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("Get", "http://"+document.all("servername").value+"/"+document.all("dbname").value+"/test?openAgent",false);
xmlhttp.Send(xDoc);
var rt=xmlhttp.responseXML.text;
alert(rt);//为什么最后这句什么也输出内容也没有
//将alert(rt)改为alert(rt.tolocalstring)也是如此.
//document.forms(0).submit();
}
先确认xmlhttp.Open("Get", "http://"+document.all("servername").value+"/"+document.all("dbname").value+"/test?openAgent",false)这一句是否正确了;也就是要打开的路径是否是正确的。
将exit;改为return;
另外,如mason520(林帆)所说,代理的url是否正常,加alert()看看。直接运行代理是否显示正常的XML。