首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

JS 给table外面加层DIV解决方案

2012-03-09 
JS 给table外面加层DIVHTMl 有个TABLETABLE styleTABLE-LAYOUT: fixed idSection2 cellSpacing0 cel

JS 给table外面加层DIV
HTMl 有个TABLE

<TABLE style="TABLE-LAYOUT: fixed" id=Section2 cellSpacing=0 cellPadding=3 width="100%">
...
</TABLE>

我现在需要在TABLE外加层DIV 即变成
<div id="test">
  <TABLE style="TABLE-LAYOUT: fixed" id=Section2 cellSpacing=0 cellPadding=3 width="100%">
  ...
  </TABLE>
</div>

我写的JS如下:
var obj = document.getElementById("Section2");
obj.insertAdjacentHTML("beforeBegin", "<div id="test">");

但发现不对。。。高手求解


[解决办法]
完整代码?

热点排行