获取焦点, 失去焦点

来源:互联网 发布:出国才知中国好视频 编辑:程序博客网 时间:2024/04/28 17:40
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="Jquery1.7.js" type="text/javascript"></script>
     <script type="text/javascript">
         $(function () {
             $('#Text1').bind({ 'focus': function () { alert('获取焦点'); }, 'blur': function () { alert('失去焦点'); }, 'keyup': function () { alert($(this).val()) } })
         })
    </script>
</head>
<body>
 <input id="Text1" type="text" />
    <br />
    <input id="Text2" type="text" />
</body>
</html>
原创粉丝点击