还有Class等等如果用css
cellSpacing=1 cellPadding=0 width="100%" align=center border=0 
怎么描述?

解决方案 »

  1.   

    <TABLE id=tb1 style="..." cellSpacing=1 cellPadding=0 width="100%" align=center border=0 bgcolor=red><tr><td>....</td></tr></table><TABLE id=tb2>....</table><input type=button onclick="o=document.all.tb1.cloneNode(true);o.id='tb2';document.all.tb2.replaceNode(o)">
      

  2.   

    <TABLE id=tb1 style="..." cellSpacing=1 cellPadding=0 width="100%" align=center border=0 bgcolor=red><tr><td>....</td></tr></table><TABLE id=tb2>....</table><input type=button onclick="o=document.all.tb1.cloneNode(true);o.id='tb2';document.all.tb2.replaceNode(o);alert(document.all.tb2.outerHTML)" value="do it">
      

  3.   

    <table id=tb1 style="color:red" cellSpacing=1 cellPadding=0 width="100%" align=center border=0>
      <tr>
        <td width="100%">1</td>
      </tr>
      <tr>
        <td width="100%">2</td>
      </tr>
    </table><table id=tb2>
      <tr>
        <td width="100%"> 1</td>
      </tr>
      <tr>
        <td width="100%">2 </td>
      </tr>
    </table>
    <script>o=tb1.cloneNode(true);o.id='tb2';tb2.replaceNode(o)</script>
      

  4.   

    阿 这个有点太厉害了
    全都换了,包括内容我想只换样式
    纯粹是这里面的内容
    <TABLE id=tb1 style="..." cellSpacing=1 cellPadding=0 width="100%" align=center border=0 bgcolor=red>
      

  5.   

    包括
    style="..." cellSpacing=1 cellPadding=0 width="100%" align=center border=0 bgcolor=red
      

  6.   

    tb1.outerHTML.substring(0,tb1.outerHTML.search('>')+1));
    这样能简单的实现取出table标签内的内容
    但ID却会重复
    怎么板呢?
      

  7.   

    var sHTML=<new_table_id>.innerHTML
    <new_table_id>.mergeAttributes(<old_table_id>)
    <new_table_id>.innerHTML=sHTML
      

  8.   

    使用mergeAttributes不会改变id,但是会拷贝event
      

  9.   

    <table id=tb1 style=color:red cellSpacing=1 cellPadding=0 width="100%" align=center border=5>
      <tr>
        <td width="100%">1</td>
      </tr>
      <tr>
        <td width="100%">2</td>
      </tr>
    </table><table id=tb2>
      <tr>
        <td width="100%"> 1</td>
      </tr>
      <tr>
        <td width="100%">2 </td>
      </tr>
    </table>
    <script>
    tb2.mergeAttributes(tb1)
    </script>
      

  10.   

    使用mergeAttributes不会改变id,但是会拷贝event好 要的就是全部!