JSP:
<td class="bottom" width="650px">
<c:forEach varStatus="status" var="sCd" items="${gForm.zList}">
<div style="display:inline;" nowrap>
<html:multibox name="gForm" property="sCd" value="${f:h(sCd.value)}" styleId="zzssyCd${status.index+1}"/><span>${f:h(sCd.label)}</span>
</div>
</c:forEach>
<c:if test="${gForm.zList.isEmpty()}"> </c:if>
</td>
<td class="button_bg"><input type="button" class="button_bg" value='全選択' οnclick="selectAll('sCd');"></td>
<td class="button_bg"><input type="button" class="button_bg" value='全解除' οnclick="unSelectAll('sCd');"></td>
JS:
//=============================================================================
// 一覧全選択ボタンクリック処理
//【 入力 】チェックボックス名
//【 返却 】None
//【 概要 】一覧全選択ボタンクリック処理
//=============================================================================
function selectAll(checkboxName) {
$('[name="' + checkboxName + '"]').each(
function() {
if (!this.checked) {
this.checked = true;
}
}
)
}
//=============================================================================
// 一覧全解除ボタンクリック処理
//【 入力 】チェックボックス名
//【 返却 】None
//【 概要 】一覧全解除ボタンクリック処理
//=============================================================================
function unSelectAll(checkboxName) {
$('[name="' + checkboxName + '"]').each(
function() {
if (this.checked) {
this.checked = false;
}
}
)
}
<td class="bottom" width="650px">
<c:forEach varStatus="status" var="sCd" items="${gForm.zList}">
<div style="display:inline;" nowrap>
<html:multibox name="gForm" property="sCd" value="${f:h(sCd.value)}" styleId="zzssyCd${status.index+1}"/><span>${f:h(sCd.label)}</span>
</div>
</c:forEach>
<c:if test="${gForm.zList.isEmpty()}"> </c:if>
</td>
<td class="button_bg"><input type="button" class="button_bg" value='全選択' οnclick="selectAll('sCd');"></td>
<td class="button_bg"><input type="button" class="button_bg" value='全解除' οnclick="unSelectAll('sCd');"></td>
JS:
//=============================================================================
// 一覧全選択ボタンクリック処理
//【 入力 】チェックボックス名
//【 返却 】None
//【 概要 】一覧全選択ボタンクリック処理
//=============================================================================
function selectAll(checkboxName) {
$('[name="' + checkboxName + '"]').each(
function() {
if (!this.checked) {
this.checked = true;
}
}
)
}
//=============================================================================
// 一覧全解除ボタンクリック処理
//【 入力 】チェックボックス名
//【 返却 】None
//【 概要 】一覧全解除ボタンクリック処理
//=============================================================================
function unSelectAll(checkboxName) {
$('[name="' + checkboxName + '"]').each(
function() {
if (this.checked) {
this.checked = false;
}
}
)
}