- <table class="table table-border table-bordered table-hover table-bg" id="mytable">
- <thead>
- <tr>
- <th scope="col" colspan="6">用户统计列表</th>
- </tr>
- <tr class="text-c">
- <th width="10">编号</th>
- <th width="30">用户名</th>
- <th width="20">存款</th>
- <th width="20">下注</th>
- <th width="20">中奖</th>
- </tr>
- </thead>
- <tbody>
- {volist name="data" id="vo"}
- <tr style="text-align: center">
- <td>{$vo.id}</td>
- <td>{$vo.nickname}</td>
- <td>{$vo.coin}</td>
- <td>{$vo.coin}</td>
- </tr>
- {/volist}
- {$quick ? $quick : ''}
- </tbody>
- <tr id="totalRow"></tr>
- </table>
- <tr>
- <td>所有用户总计</td>
- <td></td>
- <td></td>
- <td>{$sum_coin}</td>
- </tr>
js:
- <script>
- $(document).ready(function() {
- var totalRow = 0;
- $('#mytable tr').each(function() {
- $(this).find('td:eq(2)').each(function(){
- totalRow += parseFloat($(this).text());
- });
- });
- $('#totalRow').append('<td>当前页合计</td><td></td><td>'+totalRow.toFixed(2)+'</td>');
- });
- </script>
上一篇:
php实现数据库备份
友情提示:垃圾评论一律封号...