代码示例:(标识:jsck_element_blur)
<!DOCTYPE html>
<html>
<style>
a:focus, a:active {
  color: red;
}
</style>

<body>
<h1>Element 对象</h1>

<h2>focus() 和 blur() 方法</h2>

<a id="myAnchor" href="https://www.sou-xun.com">访问 sou-xun.com</a>

<p>单击按钮可为上面的链接赋予或移除焦点。</p>

<input type="button" onclick="getfocus()" value="获得焦点">
<input type="button" onclick="losefocus()" value="丢失焦点">

<script>
function getfocus() {
  document.getElementById("myAnchor").focus();
}

function losefocus() {
  document.getElementById("myAnchor").blur();
}
</script>

</body>
</html>
运行结果: