HTML DOM blur() 方法
定义和用法
focus() 方法用于从下拉列表中移开焦点。
语法
selectObject.blur()
实例
下面的例子可设置或从下拉列表移开焦点:
<html>
<head>
<script type="text/javascript">
function setFocus()
{
document.getElementById('select1').focus()
}
function loseFocus()
{
document.getElementById('select1').blur()
}
</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" />
<input type="button" onclick="loseFocus()" value="Lose focus" />
</form>
</body>
</html>