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("請確認(rèn)這是您的真實(shí)姓名") } </script> </head> <body> <form> 姓名: <input name="username" type="text" value="請輸入姓名" onblur="fun()" > </form> </body> </html>