focus()获取焦点和blur()失去焦点事件
2014-07-30 10:29
393 查看
<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>
<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>
相关文章推荐
- jquery失去焦点与获取焦点事件blur() focus()
- jquery失去焦点与获取焦点事件blur() focus()
- jquery失去焦点与获取焦点事件blur() focus()
- focus()表示获取焦点,blur()是指失去焦点
- 关于窗体和控件获取与失去输入焦点的事件
- Knockout: 使用CSS绑定和event的blur失去焦点事件, 给未通过校验的输入框添加红色边框突出显示.
- input中blur失去焦点事件与点击事件冲突的解决方法
- 获取焦点失去焦点响应事件
- jQuery的获取焦点和失去焦点事件
- input框获取焦点和失去焦点,select框change事件
- 移动端的获取焦点和失去焦点事件
- QT 获取焦点失去焦点事件
- JQuery学习笔记之获取焦点和失去焦点事件
- Knockout: 实践CSS绑定和jQuery的blur失去焦点事件, 给未通过校验的输入框添加红色边框突出显示.
- C#TextBox 失去与获取焦点事件
- Qt获得焦点和失去焦点处理事件 (Focus事件)
- jquery获取和失去焦点事件
- jquery的blur之后,focus获取不到焦点的解决办法
- jquery onblur事件中调用focus方法获取不到焦点问题
- Android Edittext获取焦点和失去焦点事件