JavaScript中blur的用法及作用是什么?blur是失去某个焦点的意思,一般用在输入框input,当失去焦点,那么就不会有光标显示,也就不可用输入内容。blur的用法anchorObject.blur(),下面我们就来详细的了解一下。
blur是失去焦点,那么相对的获取焦点就是focus
语法
anchorObject.blur()
实例
<html> <head> <style type="text/css"> a:active {color:green} </style> <script type="text/javascript"> function getfocus() {document.getElementById('myAnchor').focus()} function losefocus() {document.getElementById('myAnchor').blur()} </script> </head> <body> <a id="myAnchor" href="http://www.w3school.com.cn">Visit W3School.com.cn</a> <br /><br/> <input type="button" onclick="getfocus()" value="Get focus"> <input type="button" onclick="losefocus()" value="Lose focus"> </body> </html>
关于JavaScript中blur的用法就介绍到这了,需要的朋友可以参考上述代码,希望大家阅读完这篇文章能有所收获,想要了解更多linux命令的内容,请关注群英网络其它相关文章。
Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2018 群英 版权所有 茂名市群英网络有限公司
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号-36 粤公网安备 44090202000006号 粤工商备P091701000595