focus() 方法用于赋予下拉列表焦点。
selectObject.focus()
下面的例子可为下拉列表设置焦点:
<html>
<head>
<script type="text/javascript">
function setFocus()
{
document.getElementById('select1').focus()
}
</script>
</head>
<body>
<form>
<select id="select1">
<option>Apple</option>
<option>Pear</option>
<option>Banana</option>
<option>Orange</option>
</select>
<br /><br />
<input type="button" onclick="setFocus()" value="Set focus" />
</form>
</body>
</html>