JS 는 select(드 롭 다운)에서 선택 한 값 의 예제 코드 를 가 져 옵 니 다.

 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>

<script language="JavaScript">
<!--
function checkselect(objname){
o = document.getElementById(objname);
t = document.getElementById("output");
var count=0;
var intvalue="";
for(i=0;i<o.length;i++){
if(o.options[i].selected){
intvalue+=o.options[i].value+",";
count++;
}
}
t.value=intvalue.substr(0,intvalue.length-1);
alert(count);

}
//-->
</script>
<select name="objsel" size=8 multiple>
<option value="0" selected>
<option value="1">
<option value="2">
<option value="3">
<option value="4">
<option value="5">
</select>
<input type="button" onclick="checkselect('objsel');" value=" ">
:<input type="text" name="output">
</body>
</html>

좋은 웹페이지 즐겨찾기