【发布时间】:2015-10-10 21:15:28
【问题描述】:
这就是我想要实现的:在下面的函数中,当下拉菜单发生变化时,函数将从文本框中获取值并执行查找。我不想在<select> 标签中添加onchange,因为下拉菜单中还有其他功能。我可以只在下面的这个函数中添加一个 on change 吗?非常感谢!
<select id="types">
<option value ="food">food</option>
<option value ="drinks">drinks</option>
<select>
function lookup(){
var keyword = input.value;//get value from text box
var type = document.getElementById("types").value;//get value from drop down menu
if (search=="food"){
//perform look up
//I 'm trying to make it do another search when the type from the drop down menu changes
}else{
}
}
【问题讨论】:
-
不清楚你在问什么
-
除了将“onchange”放在下拉菜单
-
请先发布您的“相关”HTML 代码。
标签: javascript html events drop-down-menu onchange