1. 程式人生 > >前臺頁面獲取checkbox值 例子

前臺頁面獲取checkbox值 例子

cells ora 名稱 log 前臺 asc location post bsp

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="mian_b_bg">
<tr>
<td width="3%" class="mian_b_bg_lm"><input name="" type="checkbox" value="">&nbsp;</td>
<td width="11%" class="mian_b_bg_lm"><span></span>排序ID</td>
<td width="15%" class="mian_b_bg_lm"><span></span>名稱</td>
<td width="40%" class="mian_b_bg_lm"><span></span>電話</td>
<td width="40%" class="mian_b_bg_lm"><span></span>操作</td>
</tr>
<tr>
<td>
<c:forEach var="list" items="${userList}">
<tr>
<td><input name=id type="checkbox" value="${list.id}">&nbsp;</td>
<td>${list.id}</td>
<td>${list.useraccount}</td>
<td>${list.usermobile}</td>
<td width="8%" class="mian_b_icon_01"><a href="toUpdate.do?id=${list.id}">編輯</a></td>
</tr>
</c:forEach>
</td>
<td>
</tr>
</table>

<script type="text/javascript">

function del() {
var value = document.body.querySelectorAll("input[type=‘checkbox‘]");
for (var i = 0; i < value.length; i++) {
if (value[i].checked) {
var temp = value[i].value;
if (temp != null) {
if (confirm("確定要刪除嗎")) {

location.href = "delete.do?id=" + temp;

}
}

}
}

}
</script>

前臺頁面獲取checkbox值 例子