select 에서 여러값 선택 (multiple)
페이지 정보
작성자 최고관리자 작성일 21-02-10 17:30 조회 8,795 댓글 0본문
<?
if($mode == "process"){
echo "$val <p>";
}
?>
<script language='javascript'>
function selectVal(){
var obj=document.all.test;
var val='';
for(i=0; i<obj.length; i++){
if(obj.options[i].selected == true){
val+=','+obj.options[i].value; (또는 화면에 보이는 텍스트의 경우 val+=','+obj.options[i].text;)
}
}
document.all.val.value=val.substring(1,val.length);
}
</script>
<form name=signform action="<?=$PHP_SELF?>">
<input type=hidden name=mode value=process>
<input type=hidden name=val>
<select name=test size=5 multiple onchange='selectVal()'>
<option value=1> 1 </option>
<option value=2> 2 </option>
<option value=3> 3 </option>
<option value=4> 4 </option>
<option value=5> 5 </option>
<option value=6> 6 </option>
<option value=7> 7 </option>
<option value=8> 8 </option>
<option value=9> 9 </option>
<option value=0> 0 </option>
</select>
<input type=submit value=클릭>
</form>
if($mode == "process"){
echo "$val <p>";
}
?>
<script language='javascript'>
function selectVal(){
var obj=document.all.test;
var val='';
for(i=0; i<obj.length; i++){
if(obj.options[i].selected == true){
val+=','+obj.options[i].value; (또는 화면에 보이는 텍스트의 경우 val+=','+obj.options[i].text;)
}
}
document.all.val.value=val.substring(1,val.length);
}
</script>
<form name=signform action="<?=$PHP_SELF?>">
<input type=hidden name=mode value=process>
<input type=hidden name=val>
<select name=test size=5 multiple onchange='selectVal()'>
<option value=1> 1 </option>
<option value=2> 2 </option>
<option value=3> 3 </option>
<option value=4> 4 </option>
<option value=5> 5 </option>
<option value=6> 6 </option>
<option value=7> 7 </option>
<option value=8> 8 </option>
<option value=9> 9 </option>
<option value=0> 0 </option>
</select>
<input type=submit value=클릭>
</form>
댓글목록 0
등록된 댓글이 없습니다.