tbody定義一個(gè)標(biāo)簽
當(dāng)上面變化的,在js里面做拼接就行了,拼接結(jié)束 tbody.html(XXX)
<script type="text/javascript"> $(function(){ var quotas = { 1:{name:"工商銀行",oneTime:1000}, 2:{name:"農(nóng)業(yè)銀行",oneTime:800}, 3:{name:"中國(guó)銀行",oneTime:2000}, 4:{name:"建設(shè)銀行",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"/>農(nóng)業(yè)銀行 <input type="radio" name="bank" value="3"/>中國(guó)銀行 <input type="radio" name="bank" value="4"/>建設(shè)銀行 <br/> <table> <tr> <th>銀行</th> <th>額度</th> <th>日額度</th> <th>月額度</th> <th>還有啥額度</th> </tr> <tbody id="quota"></tbody> </table></body>以上所述是小編給大家介紹的JS實(shí)現(xiàn)點(diǎn)擊Radio動(dòng)態(tài)更新table數(shù)據(jù),希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)錯(cuò)新站長(zhǎng)站網(wǎng)站的支持!
新聞熱點(diǎn)
疑難解答
圖片精選