This article describes the usage of the event object onblur event in html's DOM. Share it for your reference. The specific analysis is as follows:
The onblur event occurs when the object loses focus.
The syntax is as follows:
Copy the code as follows: onblur="SomeJavaScriptCode"
SomeJavaScriptCode is required. Specifies the JavaScript executed when the event occurs.
HTML tags that support this event:
<a>, <acronym>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>,
<button>, <caption>, <cite>, <dd>, <del>, <dfn>, <div>, <dl>, <dt>,
<em>, <fieldset>, <form>, <frame>, <frameset>, <h1> to <h6>, <hr>, <i>,
<iframe>, <img>, <input>, <ins>, <kbd>, <label>, <legend>, <li>,
<object>, <ol>, <p>, <pre>, <q>, <samp>, <select>, <small>, <span>,
<strong>, <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>,
<th>, <head>, <tr>, <tt>, <ul>, <var>
JavaScript objects that support this event:
button, checkbox, fileUpload, layer, frame, password,
radio, reset, submit, text, textarea, window
Example: Execute JavaScript code when the user leaves the input box:
Copy the code as follows: <html>
<head>
<script type="text/javascript">
function upperCase()
{
var x=document.getElementById("fname").value
document.getElementById("fname").value=x.toUpperCase()
}
</script>
</head>
<body>
Enter your name:
<input type="text" id="fname" onblur="upperCase()" />
</body>
</html>
I hope this article will be helpful to everyone's JavaScript programming.