- Stat 内置变量 使用只需 变量名+Stat即可
- 可以获取index,count,size,current,even,odd,first,last等属性
<td >
<button value="显示照片" th:onclick="fn([[${userStat.index}]])" style="display: block;" th:id="wol+${userStat.index}">显示照片</button>
<img style="height: 150px;width: 200px;display: none" class="img-responsive" th:src="${user.userImg}" alt="" th:id="img+${userStat.index}" />
</td>
<td >
<button value="显示照片" th:οnclick="fn([[${userStat.index}]])" style="display: block;" th:id="wol+${userStat.index}">显示照片</button>
<img style="height: 150px;width: 200px;display: none" class="img-responsive" th:src="${user.userImg}" alt="" th:id="img+${userStat.index}" />
</td>
<script>
function fn(id) {
var img=$("#img"+id);
if(document.getElementById("wol"+id).innerHTML=="显示照片"){
img.show();
document.getElementById("wol"+id).innerHTML="隐藏照片";
}else {
img.hide();
document.getElementById("wol"+id).innerHTML="显示照片";
}
}
</script>