日期:2014-05-16 浏览次数:20443 次
function AjaxCallBack(json){
json={?"TdFields":?[{?"Col01":?"姓名","Col02":?"手机"}]};?
????var?tHead =?"<tr>";????
????$.each(json.TdFields,?function?(key,?val)?{
????????for?(k?in?this)?tHead?+=?"<td class='bg_thead?pl_10'>"?+?this[k]?+?"</td>";
????});
????tHead +=?"</tr>";????
$("#tbItem thead").append(tHead);
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
.cl{
background-color: red;
}
</style>
</head>
<body>
<table>
<thead class='c1'>
<tr>
<td>name</td>
<td>phone</td>
</tr>
</thead>
<tbody>
<tr>
<td>JJ</td>
<td>4445</td>
</tr>
<tr>
<td>YY</td>
<td>765</td>
</tr>
</tbody>
</table>
</body>
</html>