javascript 焦点的使用方法

来源:互联网 发布:php implode join 编辑:程序博客网 时间:2024/04/30 06:48
<!DOCTYPE html><html>  <head>    <title>js16.html</title>    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">    <meta http-equiv="description" content="this is my page">    <meta http-equiv="content-type" content="text/html; charset=UTF-8">        <!--<link rel="stylesheet" type="text/css" href="./styles.css">--><!-- 焦点的使用方法 --><script type="text/javascript">function checkPass(object){if(object.value.length <= 4){alert("密码长度过短");object.focus();//把焦点放到输入框里object.select();//选中输入框中的所有}}</script>  </head>    <body>         密码:<input type = "password" onblur = "checkPass(this);">   </body></html>

说明:onblur 一个控件在控件获得焦点时触发,是聚焦事件。
原创粉丝点击