首页 > 语言 > JavaScript > 正文

使用JS批量选中功能实现更改数据库中的status状态值(批量展示

2024-05-06 15:06:31
字体:
来源:转载
供稿:网友

我们在开发项目的时候经常会在后台管理时用到批量展示功能来动态的修改数据库的值。下面以修改数据库的status状态值来实现批量展示功能。批量选中功能引用js来实现。

前端html代码:

<table class="mlt" style="border:1px solid red;"><thead><tr><if condition="$type eq 'pg'"><th colspan="9" style="text-align:left;padding-left:20px;background-color:#e5e4e4;color:#c10e23;">实物商品</th><else/><th colspan="8" style="text-align:left;padding-left:20px;background-color:#e5e4e4;color:#c10e23;">虚拟商品</th></if><th style="background-color:#e5e4e4;"><a href="{:U('Mall/AddMall',array('type'=>$type))}" style="color:#c10e23;text-decoration:none;">+新增商品</a></th> </tr><tr><th style="background-color:#f7f7f7;width:8%;text-align:center;" class="lf"><input name='chkAll' type='checkbox' id='chkAll' onClick="checkAll(this, 'id[]')" value='checkbox' /> 全选</th><th style="background-color:#f7f7f7;width:8%;" class="lf">商品编号</th><th style="background-color:#f7f7f7;width:13%;" class="lf">名称</th><th style="background-color:#f7f7f7;width:18%;" class="lf">标题</th><if condition="$type eq 'pg'"><th style="background-color:#f7f7f7;width:8%;" class="lf">品牌</th></if><th style="background-color:#f7f7f7;width:8%;" class="lf">组别</th><th style="background-color:#f7f7f7;width:5%;" class="lf">排序</th><th style="background-color:#f7f7f7;width:5%;" class="lf">状态</th><th style="background-color:#f7f7f7;width:10%;">图标</th><th style="background-color:#f7f7f7;text-align:center;" class="lf">操作</th></tr></thead><tbody><volist name="list" id="vo"><tr><td class="lf" style="text-align:center;"><input name='id[]' type='checkbox' value='{$vo.id}' onClick="checkItem(this, 'chkAll')"></td><td class="lf">{$vo['code']}</td><td class="lf">{$vo['name']}</td><td class="lf">{$vo['title']}</td><if condition="$type eq 'pg'"><td class="lf">{$vo['brand']}</td></if><td class="lf">{$vo['ggroup']}</td><td class="lf">{$vo['sortno']}</td><td class="lf"><if condition="$vo['status'] eq 1">展示<else/>不展示</if></td><td><img src="{$vo['base_img']}" style="width:40px;" /></td><td class="lf" style="text-align:center;"><a href="{:U('Mall/NextLevel',array('pid'=>$vo['id']))}" class='cz' style="text-decoration:none;">编辑子信息</a><a href="{:U('Mall/UpdateMall',array('id'=>$vo['id']))}" class='cz' style="text-decoration:none;margin:0 7px;">编辑</a><a href="{$Think.config.WEB_URL}/Shop/GoodsDetails.html?pid={$vo['id']}&type={$vo['type']}" class='cz' style="text-decoration:none;" target="_Blank">查看</a></td></tr></volist><tr height="45"><td colspan="10" style="text-align:left;padding-left:40px;"><input type="button" id="btn_show" value="批量展示" class="btn_normal" style="width:100px;margin-left:20px;"></td> </tr></tbody></table><div>{$page}</div>            
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选