【发布时间】:2013-06-13 20:34:12
【问题描述】:
我有一个选择,我想根据他们在菜单中单击它时选择的内容来运行不同的 javascript 函数。我的谷歌搜索没有结果,谁能指导我到正确的属性? (例如,我知道 onclick 适用于按钮)。提前感谢您的帮助!
编辑:onchange 在我的代码中不起作用。
<head>
<script>
function goToDelete(){
document.write("Death to this webpage!")
}
</script>
</head>
<form id="checkboxes" method="post" action="someurl">
<tr>
<td><input type="checkbox" name="Selection"/></td>
<td>Some more rows to the table here</td>
</tr>
<select name="action">
<option value="Delete" onchange="goToDelete()">Delete</option>
</select>
【问题讨论】:
-
如果您打算使用库 (
jQuery) 回答问题,请不要忘记 performance issue
标签: javascript html select