创建代理xmlAgent
Sub Initialize
Dim strPost As String, strPre As String
Dim i as Integer
strPre = "<![CDATA["
strPost = "]]>"
Print |Content-Type:text/xml;charset=gb2312|
Print "<root>"
For i=1 To 10
Print "<ou>" & strPre & Cstr(i) & strPost & "</ou>"
Next
Print "</root>"
End Sub
表单上调用js代码
function getRes()
{
var post_xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
post_xmlHttp.open("POST","xmlAgent?OpenAgent",false);
post_xmlHttp.send();
var returnXML = post_xmlHttp.responseText;
var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.async = false;
xmldoc.loadXML(returnXML);
var root = xmldoc.documentElement;
var xItems = root.selectNodes("ou");
for(var i=1;i<=xItems.length;i++)
{
alert(xItems[i-1].firstChild.text);
}
}