现在的位置: 首页 > 综合 > 正文

js xml文件加载

2018年06月09日 ⁄ 综合 ⁄ 共 568字 ⁄ 字号 评论关闭
 function loadXMLDoc(dname) {
            try //Internet Explorer
            {
                xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
            }
            catch (e) {
                try //Firefox, Mozilla, Opera, etc.
                {
                    xmlDoc = document.implementation.createDocument("", "", null);
                }
                catch (e) { alert(e.message) }
            }
            try {
                xmlDoc.async = false;
                xmlDoc.load(dname);
                return (xmlDoc);
            }
            catch (e) { alert(e.message) }
            return (null);
        }


        xmlDoc = loadXMLDoc("zh_login.xml");

        //        xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        //        xmlDoc.async = false;
        //        //async属性可规定XML文件的下载是否应当被同步处理。
        //        //True意味着load()方法可在下载完成之前向调用程序返回控制权。
        //        //False意味着在调用程序取回控制权之前下载必须被完成。
        //        //asp程序只能用False
        //        xmlDoc.load("zh_login.xml");

抱歉!评论已关闭.