xxxxxxxxxx
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>
<input type="text" id="myText" value="文本域">
<p>点击按钮设置或移除以上文本域的焦点。</p>
<input type="button" onclick="getfocus()" value="获取焦点">
<input type="button" onclick="losefocus()" value="移除焦点">
<script>
function getfocus() {
document.getElementById("myText").focus();
}
function losefocus() {
document.getElementById("myText").blur();
}
</script>
</body>
</html>