【发布时间】:2018-02-05 07:08:28
【问题描述】:
这里我有多个列表框,当我点击一个选项时,动态文本框应该生成 Javascript。
<html>
<head>
<script type="text/javascript">
function changeFunc() {
var selectBox = document.getElementById("selectBox");
var selectedValue = selectBox.options[selectBox.selectedIndex].value;
alert(selectedValue);
}
</script>
</head>
<body>
<select id="selectBox" multiple onchange="changeFunc();">
<option value="1">Option #1</option>
<option value="2">Option #2</option>
</select>
</body>
</html>
【问题讨论】:
-
dynamic textbox must be generated在哪里生成呢? -
在列表框下,每次点击列表框都要创建文本框
标签: javascript html javascript-objects dom-events