javascript读取xml数据后生成一个表格,并且表格有自动添加列的功能 怎么实现?

来源:百度知道 编辑:UC知道 时间:2024/09/21 01:34:02
javascript读取xml数据后生成一个表格,并且表格有自动添加列的功能 怎么实现?哪位大侠帮帮忙啊?
有答案我再给分啊,大家帮忙

这是我的XML格式,主要结构:
<?xml version="1.0" encoding="UTF-8" ?>
<xmlRoot>
<records>
<record>

<_field1>..内容..</_field1>
<_field2>..内容..</_field2>

</record>
</records>
</xmlRoot>

--------------------------------------------------------------
function XMLReader( strXML )
{
try
{
_domXML = new ActiveXObject("Microsoft.XMLDOM");
_domXML.loadXML( strXML );
this.domRoot=_domXML.documentElement;
this.records = this.domRoot.getElementsByTagName( "record");
this.rowCount =this.records.length;
this.fieldCount =0;
this.row =0;
//---------------------------------------------
if(this.rowCount>0)
{
var firstRow = this.records[0];
this.fie