用xsl
CSDN就是xml+xsl写的,研究一下吧

解决方案 »

  1.   

    一个从xml读数写到select中的函数
    /***********************************************
    函数名: funGetValues1
    作者:赵晓阳
    做成日期: 2004-02-17
    修改者/日期:
    参数:   name: 列表名
                    srcDlt: 列表ID
                    code: 代码
    功能描述:根据参数查数据库中的列表项
    ************************************************/
    function funGetValues(name,srcDlt,cncode,code,key)
    {
            var sels=srcDlt;
            if(sels.tagName!="SELECT")
              sels=srcDlt.parentElement.parentElement.cells[0].children[0];        sels.innerHTML="";
            var xmldoc = new ActiveXObject("msxml");
            var xmlsrc = "/scheduler/jsp/include/OptKeyNameXml.jsp?Name="+name+"&Code="+code+"&CnCode="+cncode+"&Key="+key;
            xmldoc.URL = xmlsrc;
            var root=xmldoc.root;
            var children=root.children;
            //<!--没有符合条件的记录时,提示-->
            if(children==null){
              var opts=document.createElement("OPTION");
                    sels.options.add(opts);
                    opts.value="";
                    opts.text="";
                    sels.options[0].selected;
                    sels.focus();
                    return false;
            }
            //<!--将结果写入ShipId下拉列表框-->
            var rootLength=children.length;
            for(var i=0;i<rootLength;i++)
            {
                    var opts=document.createElement("OPTION");
                    sels.options.add(opts);
                    opts.value=children.item(i).getAttribute("value");
                    opts.code=children.item(i).getAttribute("code");
                    opts.name=children.item(i).getAttribute("name");
                    opts.parentId=children.item(i).getAttribute("ParentId");
                    opts.text=children.item(i).getAttribute("name");
            }
            sels.options[0].selected;
            sels.focus();
            return false;
    }
      

  2.   

    zhaoxiaoyang
    你的加载XML文件是怎么能得到那个里面的属性呢?
    我现在做的是一个需要解析XML的中间键,但是我一直得不到里面的属性
      

  3.   

    opts.value=children.item(i).getAttribute("value");