想在下面代码中的 tbody 标签内的 每一行的末尾添加一个单选按钮
也就是 <tr 单选按钮 td td />这样的格式 注意是 tbody内的部分不是所有的,用jquery实现
###############################################################################
<table class="table table-condensed table-striped table-bordered table-hover">
<thead>
<tr>
<th>
属性编号
</th>
<th>
属性名称
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
44974620000200020002
</td>
<td>
XLL
</td>
</tr>
<tr>
<td>
44974620000200020001
</td>
<td>
XL
</td>
</tr>
</tbody>
</table>
<div class="pagination">
<ul>
<li class="disabled"><a>上一页</a></li>
<li class="active" ><a href="http://localhost:8080/cmanage/show/page_three_list_v_pc_property?zw_f_parent_code=4497462000020002&zw_p_count=2&zw_p_index=1
">1</a></li>
<li class="disabled"><a>下一页</a></li>
</ul>
<span class="pagination_label">共2条</span>
</div>
</div>jquery
也就是 <tr 单选按钮 td td />这样的格式 注意是 tbody内的部分不是所有的,用jquery实现
###############################################################################
<table class="table table-condensed table-striped table-bordered table-hover">
<thead>
<tr>
<th>
属性编号
</th>
<th>
属性名称
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
44974620000200020002
</td>
<td>
XLL
</td>
</tr>
<tr>
<td>
44974620000200020001
</td>
<td>
XL
</td>
</tr>
</tbody>
</table>
<div class="pagination">
<ul>
<li class="disabled"><a>上一页</a></li>
<li class="active" ><a href="http://localhost:8080/cmanage/show/page_three_list_v_pc_property?zw_f_parent_code=4497462000020002&zw_p_count=2&zw_p_index=1
">1</a></li>
<li class="disabled"><a>下一页</a></li>
</ul>
<span class="pagination_label">共2条</span>
</div>
</div>jquery
var trs=document.getElementsByTagName("tr");
for(var i=0;i<trs.length;i++){
var td=document.createElement("td");
var input=document.createElement("input");
input.type='radio';
input.name='test';
td.appendChild(input);
trs[i].appendChild(td);
}
}
var re=new RegExp(repString,"g"); // "<tr>"
var newstart = result1.replace(re, renEndString) // "<tr> <td> <input type='radio' name='m2' value='status'/> </td>"
sourceString = result2 + newstart;