静态注册焦点失去事件
![复制代码](https://common.cnblogs.com/images/copycode.gif)
<head> <meta charset="UTF-8"> <title>Title</title> <style type="text/css"> div{ position: center; /*margin-top: 50px;*/ /*margin-left: 400px;*/ } </style> <script type="text/javascript"> var onblurfun = function (){ console.log("静态注册的失去焦点事件") } </script> </head> <body> <div> <p>用户名:<input type="text" onblur="onblurfun()"></p> <p>密 码:<input type="password"></p> </div> </body>
![复制代码](https://common.cnblogs.com/images/copycode.gif)
动态注册失去焦点事件
![复制代码](https://common.cnblogs.com/images/copycode.gif)
window.onload = function (){ var passwordObj = document.getElementById("password") //获取对象 passwordObj.onblur = function (){ //对象.事件名 = function(){} console.log("动态注册失去焦点事件") } }标签:总结,function,每周,焦点,失去,事件,注册,nbsp From: https://www.cnblogs.com/-0112/p/16589936.html