jquery绘制表格的对齐方式问题
jQuery代码如下:
var html = "<table style='width:100%;valign:top;'>"; for (var x = 0; x < machines.length; x++) { if ($(this).attr("id") == machines[x].ID.substring(0, 3)) html += ("<tr><td><input type='checkbox' id='" + machines[x].ID + "' />" + machines[x].ID + "</td></tr>"); } html += "</table>"; $("#grid_machines td[id=" + $(this).attr("id") + "]").append(html);
<!DOCTYPE HTML><html lang=""><head> <meta charset="gbk"> <title></title> <style type="text/css"> td { border:1px solid red; } </style></head><body> <table> <tr> <td height="200" valign="top">1-1</td> <td>1-1</td> <td>1-1</td> <td>1-1</td> </tr> <tr> <td>1-1</td> <td>1-1</td> <td>1-1</td> <td>1-1</td> </tr> </table></body></html>