JS - 全部选择、取消全部选择 - 2
<script>
function SelectAll() {
var operate = $(".member_tab tr");
var bool = $("#allchecked").attr('checked');
operate.each(function () {
$(this).find('input[type=checkbox]').attr("checked", bool ? true : false);
});
}
</script>
<table class="member_tab" width="100%">
<!--{if $peoplestr}-->
<tr>
<th style=" text-align:center;" width="4%">
<input name="xuan" type="checkbox" id="allchecked" onclick="SelectAll()" />
</th>
<th><span>|</span>用户名</th>
<th><span>|</span>姓名</th>
<th><span>|</span>手机号</th>
<th><span>|</span>邮箱</th>
</tr>
<!--{foreach item=people from=$peoplestr name=foo}-->
<tr>
<td style="text-align:center;">
<!--{if $people.uuid neq $uuid}-->
<input name="delte" type="checkbox" value="<!--{$people.id}-->" />
<!--{/if}-->
</td>
<td><!--{$people.username}--></td>
<td><!--{$people.name}--></td>
<td><!--{$people.move}--></td>
<td><!--{$people.email}--></td>
</tr>
<!--{/foreach}-->
<!--{/if}-->
</table>
高级版
<script>
//全选
function SelectAll() {
var operate = $(".member_tab tr");
var bool = $("#allchecked").is(':checked');
operate.each(function () {
if(!$(this).find('input[type=checkbox]').is(":disabled"))
{
$(this).find('input[type=checkbox]').attr("checked", bool ? true : false);
}
});
}
</script>
<table class="member_tab" width="100%">
<!--{if $peoplestr}-->
<tr>
<th style=" text-align:center;" width="4%">
<input name="xuan" type="checkbox" id="allchecked" onclick="SelectAll()" />
</th>
<th><span>|</span>用户名</th>
<th><span>|</span>姓名</th>
<th><span>|</span>手机号</th>
<th><span>|</span>邮箱</th>
</tr>
<!--{foreach item=people from=$peoplestr name=foo}-->
<tr>
<td style="text-align:center;">
<!--{if $people.uuid neq $uuid}-->
<input name="delte" type="checkbox" value="<!--{$people.uuid}-->" />
<!--{else}-->
<input name="delte" type="checkbox" value="<!--{$people.uuid}-->" onclick="return false;" disabled="disabled"/>
<!--{/if}-->
</td>
<td>
<!--{if $people.uuid neq $uuid}-->
<!--{$people.username}-->
<!--{else}-->
<b><!--{$people.username}--></b>(组织建立者)
<!--{/if}-->
</td>
<td><!--{$people.name}--></td>
<td><!--{$people.move}--></td>
<td><!--{$people.email}--></td>
</tr>
<!--{/foreach}-->
<!--{/if}-->
</table>
好奇的问一下,那个用户头像怎么设置,为什么我的头像一直是这样的呢
需要去 avatar 设置一下
总结的很不错哟,值得学习。
谢谢夸奖 ๑乛◡乛๑
@(真棒)收藏
棒棒哒 ๑乛◡乛๑
学习了~
好好学习,天天向上 ๑乛◡乛๑