[JavaScript] 자바스크립트 동적 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="">
<script language="JavaScript">
<!--
function aa(){
for(var i=0; i < document.getElementById("a").length; i++){
//alert(document.getElementById("a")[i].text);
if("5" == document.getElementById("a")[i].value){
document.getElementById("a")[i]=null;
}
}
document.getElementById("a")[document.getElementById("a").length] = new Option("값","밸류");
}
//-->
</script>
</head>
<body onLoad="aa();">
※ select 박스 55 값 동적으로 변경하는 샘플
<select name="a" id="a">
<option value="1" selected>11
<option value="2">22
<option value="3">33
<option value="4">44
<option value="5">55
</select>
</body>
</html>