有N个xml文件

http://i.cnah.cn/xml/topic_1.xml
http://i.cnah.cn/xml/topic_2.xml请问如何使用function readxml(fileurl){
  
}来读取指定的xml文档,并将值返回?
因为我是做为帖子操作日志,一个页面中,可能会有N个 topic_n.xml需要加载,所以需要一个公用的函数来把xml的值返回给我,然后单独处理!本人目前使用的是jquery 里面有 ajax 可以做,但本人只能做单个的,对于多个的,不知道该怎么做了!
特此求教大家。非常感谢

解决方案 »

  1.   

    <html>
    <head>
    <title>AjaxTest</title>
    <script>
    var xmlHttp;
    function createXMLHttpRequest()
    {
        if(window.ActiveXObject)
        {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        else if(window.XMLHttpRequest)
        {
            xmlHttp = new XMLHttpRequest();
        }
    }
    function startRequest()
    {
        createXMLHttpRequest();
        try
        {
            xmlHttp.onreadystatechange = handleStateChange;
            xmlHttp.open("GET", "data.xml", true);
            xmlHttp.send(null);
        }
        catch(exception)
        {
            alert("xmlHttp Fail");
        }
    }
    function handleStateChange()
    {
        if(xmlHttp.readyState == 4)
        {
            if (xmlHttp.status == 200 || xmlHttp.status == 0)
            {
                var root = xmlHttp.responseXML.documentElement;
                try
                {
                    var info = root.getElementsByTagName("info")[0];
                    alert(info.firstChild.nodeValue);
                }
                catch(exception)
                {
                    alert("The node is not exist");
                }
            }
        }
    }
    </script>
    </head>
    <body>
        <div>
            <input type="button" value="AjaxTest" onclick="startRequest();" />
        </div>
    </body>
    </html>xml:
    <?xml version="1.0" encoding="GB2312"?> 
    <root>
        <info>AjaxTestSuccess</info>
    </root>
      

  2.   

    for(var i=0;i<9;i++ ){
        evel("readxml(topic_"+i+".xml )")
    }大概这意思 自己调调看吧 - -!