• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

解决前端页面勾选复选框显示其他按钮,没有勾选项按钮会隐藏

武飞扬头像
蓝色天空儿
帮助1

页面展示数据代码:

<button οnclick="newwork_show()" id="again" style="display: none" type="button" class="btn btn-success">再次执行</button>
<table class="table table-striped" id="fail_data" style="display: none">
    <thead>
        <tr>
            <th οnclick="checkInterset()">全选</th> <th>序号</th> <th style="width: 300px">id</th> <th style="width: 500px">用例名称</th> <th style="width: 450px">执行时间</th> <th style="width: 450px">操作</th> <th style="width: 100px">运行结果</th>
        </tr>
    </thead>
    <tbody id="bbsTab2">
         {% for i in fail_case %}
             <tr>
                 <td>
                     <form>
                         <input οnclick="show_again(this)" type="checkbox" name="insterest" value="{{ i.case_id }}"/>
                     </form>
                 </td>
                <td class="td_center">1</td>
                <td>{{ i.id }}</td><td>{{ i.case_name }}</td><td>{{ i.name }}</td>

                 <td>
                     <div class="btn-group" style="z-index: 0">
                        <a href="https://blog.csdn.net/look_report/{{ i.name }}/" target="_blank"><button class="btn btn-success" >查看报告</button></a>
                    </div>
                 </td>
                 <td><span>{{ i.result }}</span></td>

             </tr>
        {% endfor %}
    </tbody>
</table>
学新通
<!--判断复选框是否勾选,进而展示再次执行按钮-->
<script>
    function show_again() {

        var obj = document.getElementsByName("insterest");
        var objLen=obj.length;
        console.log(objLen);
        for(var i=0;i<objLen;i  ){
            if(obj[i].checked==true){
                document.getElementById('again').style.display='block';
                break;
           }
            else if(obj[i].checked==false){
               document.getElementById('again').style.display='none';
            }
        }
    }

</script>
学新通

效果图:

学新通

 学新通

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhfkbcif
系列文章
更多 icon
同类精品
更多 icon
继续加载