dpp*_*dpp 8 javascript select drop-down-menu
如何使用Javascipt强制select元素下拉?可能吗?
<select id="MiamiPlayers">
<option value="0">Bosh</option>
<option value="1">Wade</option>
<option value="2">LeBron</option>
</select>
<input type="button" onclick="Show()" />
<script type="text/javascript">
function Show()
{
//force the select to dropdown...
}
</script>
Run Code Online (Sandbox Code Playgroud)
提前致谢!
你不能打开下拉菜单,但你可以这样做:
document.getElementById('MiamiPlayers').setAttribute('size', 3);
Run Code Online (Sandbox Code Playgroud)
var select = document.getElementById(id);
select.size = select.options.length;
Run Code Online (Sandbox Code Playgroud)
其中 id 是您的选择框的 id...
| 归档时间: |
|
| 查看次数: |
10321 次 |
| 最近记录: |