【发布时间】:2012-06-13 20:57:29
【问题描述】:
我有一个选择下拉列表,在 html 页面加载时选择了 1 个项目。
<select name = "options">
<option value = "1">Item1</option>
<option value = "2" selected>Item2</option>
<option value = "3">Item3</option>
<option value = "4">Item4</option>
</select>
现在我想在用户按下 shift 并选择另一个选项(例如“Item 3”)时捕获新的选择选项。
我有以下代码来查找列表中的所有选择
var value = "";
for (var intLoop = 0; intLoop < Form.elements[index].length; intLoop++) {
if(Form.elements[index][intLoop].selected )
value = value + Form.elements[index][intLoop].value;
}
我可以看到“项目 2”和“项目 3”被选中,但我只想捕获“项目 3”。是否可以?
【问题讨论】:
-
嗨 alfasin,以下 HTML 标签支持 onselect:、、、 ,
,
标签: javascript html html-select