2

我正在尝试在弹出窗口中附加更多数据并设置表格样式。

我有

 var popup = window.open("popup.html", "popup","width=800","height=600");
     popup.document.write(
     "<table id='dataTable'>"+
      "<tr><th>test1</th><th>test2</th><th>test3<th></th>test4</th><th>test5</th></tr>" +
      "</table>");

ajax callback data
    codes....

如何附加数据并设置表格样式?

4

2 回答 2

2

用于在弹出$("#dataTable",popup.document)窗口中获取您的表格:

var popup = window.open("popup.html", "popup","width=800","height=600");
     popup.document.write(
     "<table id='dataTable'>"+
     "<tr><th>test1</th><th>test2</th><th>test3<th></th>test4</th><th>test5</th></tr>" +
     "</table>");

$("#dataTable",popup.document)
     .css("border","1px solid red") // append CSS
     .append("<tr><td>append</td></tr>"); //append HTML

这是演示

于 2012-10-05T17:11:59.673 回答
0
$('#dataTable').append(<your html>);
$('#dataTable').css({'style1':'value1', 'style2':'value2'});
于 2012-10-05T17:11:41.093 回答