커서 아웃 포커스 이벤트(onblur)
onblur 이벤트는 onfocus에 대한 상대적 이벤트입니다. 호출된 프로그램을 실행하는 동안 현재 초점이 맞춰진 객체를 onblur 이벤트에서 벗어납니다.
다음 예에서는 커서가 떠날 때 정보가 입력되었는지 여부를 사용자가 확인할 수 있습니다.
<!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>