• <sub id="h4knl"><ol id="h4knl"></ol></sub>
    <sup id="h4knl"></sup>
      <sub id="h4knl"></sub>

      <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
      1. <strong id="h4knl"></strong>

      2. js+xml自動(dòng)生成表格的代碼

        時(shí)間:2024-10-01 14:43:50 XML DOM 我要投稿
        • 相關(guān)推薦

        js+xml自動(dòng)生成表格的代碼

          復(fù)制代碼 代碼如下:

          

          

          

          無標(biāo)題文檔

          

          functionloadXML(handler){

          varurl="employees.xml";

          if(document.implementation&&document.implementation.createDocument){

          varxmldoc=document.implementation.createDocument("","",null);

          xmldoc.onload=handler(xmldoc,url);

          xmldoc.load(url);

          }

          elseif(window.ActiveXObject){

          varxmldoc=newActiveXObject("Microsoft.XMLDOM");

          xmldoc.onreadystatechange=function(){

          if(xmldoc.readyState==4)handler(xmldoc,url);

          }

          xmldoc.load(url);

          }

          }

          functionmakeTable(xmldoc,url){

          vartable=document.createElement("table");

          table.setAttribute("border","1");

          table.setAttribute("width","600");

          table.setAttribute("class","tab-content");

          document.body.appendChild(table);

          varcaption="EmployeeDatafrom"+url;

          table.createCaption().appendChild(document.createTextNode(caption));

          varheader=table.createTHead();

          varheaderrow=header.Row(0);

          headerrow.Cell(0).appendChild(document.createTextNode("姓名"));

          headerrow.Cell(1).appendChild(document.createTextNode("職業(yè)"));

          headerrow.Cell(2).appendChild(document.createTextNode("工資"));

          varemployees=xmldoc.getElementsByTagName("employee");

          for(vari=0;i<employees.length;i++){

          vare=employees[i];

          varname=e.getAttribute("name");

          varjob=e.getElementsByTagName("job")[0].firstChild.data;

          varsalary=e.getElementsByTagName("salary")[0].firstChild.data;

          varrow=table.Row(i+1);

          row.Cell(0).appendChild(document.createTextNode(name));

          row.Cell(1).appendChild(document.createTextNode(job));

          row.Cell(2).appendChild(document.createTextNode(salary));

          }

          }

          

          

          

          

          

          

          復(fù)制代碼 代碼如下:

          

          

          

          Programmer

          32768

          

          

          Sales

          70000

          

          

          CEO

          100000

          

          

        【js+xml自動(dòng)生成表格的代碼】相關(guān)文章:

        基于jQuery的固定表格頭部的代碼08-30

        Word目錄如何自動(dòng)生成02-26

        Word自動(dòng)生成目錄的方法及步驟11-30

        word的自動(dòng)生成目錄如何操作08-10

        Word表格自動(dòng)填充的方法10-13

        Excel表格自動(dòng)套用格式教程12-19

        wps中Word怎么去掉自動(dòng)生成的超鏈接09-14

        過濾HTML代碼08-29

        怎么在word表格的某一列中自動(dòng)插入數(shù)字02-15

        數(shù)控編程代碼大全05-18

        在线咨询
        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码
      3. <sub id="h4knl"><ol id="h4knl"></ol></sub>
        <sup id="h4knl"></sup>
          <sub id="h4knl"></sub>

          <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
          1. <strong id="h4knl"></strong>

          2. 亚洲精品中文字幕无线码 | 中字幕无砖欧美日韩一区中 | 亚洲色大全不卡在线观看 | 中文字幕亚洲一区婷婷 | 天天在线视频精品分类 | 色综合91久久精品中文字幕 |

            js+xml自動(dòng)生成表格的代碼

              復(fù)制代碼 代碼如下:

              

              

              

              無標(biāo)題文檔

              

              functionloadXML(handler){

              varurl="employees.xml";

              if(document.implementation&&document.implementation.createDocument){

              varxmldoc=document.implementation.createDocument("","",null);

              xmldoc.onload=handler(xmldoc,url);

              xmldoc.load(url);

              }

              elseif(window.ActiveXObject){

              varxmldoc=newActiveXObject("Microsoft.XMLDOM");

              xmldoc.onreadystatechange=function(){

              if(xmldoc.readyState==4)handler(xmldoc,url);

              }

              xmldoc.load(url);

              }

              }

              functionmakeTable(xmldoc,url){

              vartable=document.createElement("table");

              table.setAttribute("border","1");

              table.setAttribute("width","600");

              table.setAttribute("class","tab-content");

              document.body.appendChild(table);

              varcaption="EmployeeDatafrom"+url;

              table.createCaption().appendChild(document.createTextNode(caption));

              varheader=table.createTHead();

              varheaderrow=header.Row(0);

              headerrow.Cell(0).appendChild(document.createTextNode("姓名"));

              headerrow.Cell(1).appendChild(document.createTextNode("職業(yè)"));

              headerrow.Cell(2).appendChild(document.createTextNode("工資"));

              varemployees=xmldoc.getElementsByTagName("employee");

              for(vari=0;i<employees.length;i++){

              vare=employees[i];

              varname=e.getAttribute("name");

              varjob=e.getElementsByTagName("job")[0].firstChild.data;

              varsalary=e.getElementsByTagName("salary")[0].firstChild.data;

              varrow=table.Row(i+1);

              row.Cell(0).appendChild(document.createTextNode(name));

              row.Cell(1).appendChild(document.createTextNode(job));

              row.Cell(2).appendChild(document.createTextNode(salary));

              }

              }

              

              

              

              

              

              

              復(fù)制代碼 代碼如下:

              

              

              

              Programmer

              32768

              

              

              Sales

              70000

              

              

              CEO

              100000