tbody定義一個標簽
當上面變化的,在js里面做拼接就行了,拼接結束 tbody.html(XXX)
<script type="text/javascript"> $(function(){ var quotas = { 1:{name:"工商銀行",oneTime:1000}, 2:{name:"農業(yè)銀行",oneTime:800}, 3:{name:"中國銀行",oneTime:2000}, 4:{name:"建設銀行",oneTime:10}}; $(":radio").click(function(){ console.info("click:"+$(this).val()); var quota = quotas[$(this).val()]; var quotaHtml = []; quotaHtml = quotaHtml.concat([ '<tr>', '<td>'+quota.name+'</td>', '<td>'+quota.oneTime+'</td>', '<td>100</td>', '<td>100</td>', '<td>100</td>', '</td>' ]) console.info("html:"+quotaHtml); $("#quota").html(quotaHtml) }); });</script><body> <input type="radio" name="bank" value="1"/>工商銀行 <input type="radio" name="bank" value="2"/>農業(yè)銀行 <input type="radio" name="bank" value="3"/>中國銀行 <input type="radio" name="bank" value="4"/>建設銀行 <br/> <table> <tr> <th>銀行</th> <th>額度</th> <th>日額度</th> <th>月額度</th> <th>還有啥額度</th> </tr> <tbody id="quota"></tbody> </table></body>以上所述是小編給大家介紹的JS實現點擊Radio動態(tài)更新table數據,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網網站的支持!
新聞熱點
疑難解答