1
드롭 다운 상자 (자바 스크립트 사용)에서 주어진 var에 따라 주어진 옵션 이름을 선택할 수있는 함수를 작성하는 데 도움이 필요하며 값 존재하지 않으면 드롭 다운 목록에 추가 한 다음 선택하십시오.드롭 다운 상자에서 옵션 값 추가 및 선택
예 :
<html>
<head>
<script type="text/javascript">
function test() {
var option_name_to_look_for = "mangos"
if option_name_to_look_for is listed in the drop down box (drop) then select it
if the option_name_to_look_for is not listed in the drop down box (drop), automatically add it to the drop down list (drop) and select it.
}
</script>
</head>
<body>
<select id="drop" style="width: 200px;">
<option value="0"></option>
<option value="1">apples</option>
<option value="2">oranges</option>
<option value="3">pears</option>
<option value="4">mangos</option>
<option value="5">bananas</option>
<option value="6">kiwis</option>
</select>
</body>
</html>
작동중인 js가 있습니까? 그렇다면 우리는 바이올린을 얻을 수 있습니까? –