JavaScript中blur的用法是“anchorObject.blur()”,blur是失去某个焦点的意思,多用在输入框input,失去焦点,光标有不会在那里了,不能够输入内容了。
本教程操作环境:windows7系统、javascript1.8.5版、Dell G3电脑。
是失去某个焦点的意思,多用在输入框input,失去焦点,光标有不会在那里了,不能够输入内容了
相对的获取焦点就是focus
语法
立即学习“Java免费学习笔记(深入)”;
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高级教程】
以上就是JavaScript中blur的用法是什么的详细内容,更多请关注php中文网其它相关文章!
java怎么学习?java怎么入门?java在哪学?java怎么学才快?不用担心,这里为大家提供了java速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号