JavaScript cursor out-of-focus event (onblur)
Cursor out-of-focus event (onblur)
The onblur event is a relative event to onfocus. It is triggered when the cursor leaves the currently focused object. onblur event, while executing the called program.
The following example, when the cursor leaves, allows the user to confirm whether the information has been entered:
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <script> function fun(){ window.alert("请确认这是您的真实姓名") } </script> </head> <body> <form> 姓名: <input name="username" type="text" value="请输入姓名" onblur="fun()" > </form> </body> </html>