设置等级对照表的表格

h5部分

<div class="tableul">
                <table class="table" id="tabid1" style="text-align: center;"></table>
</div>

js部分

// 经验值
        var num = 30
        // 获取table节点
        var dome = document.getElementById('tabid1')
        var html =
            '<tr class="height_80"><th width="10%">等级</th><th width="75%">图标</th><th width="15%">经验值</th>';
        var mimg;
        for (let i = 1; i <= 64; i++) {
            mimg = '';
            // /img/icon_xx.png 星星
            // /img/icon_yl.png 月亮
            // /img/icon_hg.png 皇冠
            if(i==1)mimg += '<img src="./img/icon_xx.png">';
            if(i==2)mimg += '<img src="./img/icon_xx.png"><img src="./img/icon_xx.png">';
            if(i==3)mimg += '<img src="./img/icon_xx.png"><img src="./img/icon_xx.png"><img src="./img/icon_xx.png">';
            if(i<16 && i>3){
                if(i%4==0){
                    mimg += '<img src="./img/icon_yl.png">';
                }
                for (let j = 1; j < i/4; j++) {mimg += '<img src="./img/icon_yl.png">';}
                if(i%4==1){mimg += '<img src="./img/icon_xx.png">';}
                if(i%4==2){mimg += '<img src="./img/icon_xx.png"><img src="./img/icon_xx.png">';}
                if(i%4==3){mimg += '<img src="./img/icon_xx.png"><img src="./img/icon_xx.png"><img src="./img/icon_xx.png">';}
            }
            if(i==16){
                mimg ='<img src="./img/icon_hg.png">'
            }
            if(i==32){
                mimg ='<img src="./img/icon_hg.png">'
            }
            if(i==48){
                mimg ='<img src="./img/icon_hg.png">'
            }
            if(i==64){
                mimg ='<img src="./img/icon_hg.png"><img src="./img/icon_hg.png"><img src="./img/icon_hg.png"><img src="./img/icon_hg.png">'
            }
            if(i>16 && i<=63){
                for (let j = 0; j < i/16-1; j++) {
                    mimg += '<img src="./img/icon_hg.png">';
                }
                if(i>16 && i<32){
                    for (let j = 0; j < parseInt(i/4-4); j++) {mimg += '<img src="./img/icon_yl.png">';}
                }
                if(i>32 && i<48){
                    if(i%4==0){
                        mimg += '<img src="./img/icon_yl.png">';
                    }
                    for (let j = 0; j < i/4-9; j++) {mimg += '<img src="./img/icon_yl.png">';}
                }
                if(i>48 && i<64){
                    if(i%4==0){
                        mimg += '<img src="./img/icon_yl.png">';
                    }
                    for (let j = 0; j < i/4-13; j++) {mimg += '<img src="./img/icon_yl.png">';}
                }
                if(i%4==1){mimg += '<img src="./img/icon_xx.png">';}
                if(i%4==2){mimg += '<img src="./img/icon_xx.png"><img src="./img/icon_xx.png">';}
                if(i%4==3){mimg += '<img src="./img/icon_xx.png"><img src="./img/icon_xx.png"><img src="./img/icon_xx.png">';}
                
            }
            html += '<tr class="height_50"><td>' + i + '</td><td>'+mimg+'</td><td>' + num + '</td></tr>'
            num = num*2
        }
        dome.innerHTML = html;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值