multiple SelectBox 전체 선택, 해제
페이지 정보
작성자 서방님 댓글 0건 조회 185회 작성일 10-02-19 20:43본문
<select name="selectbox1" size="10" multiple>
<option>aaa</option>
<option>aaa</option>
<option>aaa</option>
<option>aaa</option>
<option>aaa</option>
<option>aaa</option>
<option>aaa</option>
</select><br />
<input type="button" name="Button" value="All Check" onclick="selectAll('selectbox1',true)" />
<input type="button" name="Button" value="All UnCheck" onclick="selectAllUn('selectbox1',true)" />
<script language="javascript">
<!--
function selectAll(selectBox,selectAll) {
// have we been passed an ID
if (typeof selectBox == "string") {
selectBox = document.getElementById(selectBox);
}
// is the select box a multiple select box?
if (selectBox.type == "select-multiple") {
for (var i = 0; i < selectBox.options.length; i++) {
//selectBox.options[i].selected = selectAll;
selectBox.options[i].selected = true;
}
}
}
function selectAllUn(selectBox,selectAll) {
// have we been passed an ID
if (typeof selectBox == "string") {
selectBox = document.getElementById(selectBox);
}
// is the select box a multiple select box?
if (selectBox.type == "select-multiple") {
for (var i = 0; i < selectBox.options.length; i++) {
selectBox.options[i].selected = false;
}
}
}
//-->
</script>
댓글목록
등록된 댓글이 없습니다.