JavaScript Reference/Javascript Methods/blur

Материал из Web эксперт
Перейти к: навигация, поиск

"blur()" Example

   <source lang="javascript">
   

<html> <body> <script language="JavaScript"> function function1(){

  document.getElementById("myButton").blur();
  document.getElementById("myButton").innerText = "This button lost its focus";
  alert("The button lost its focus"); 

} </script> <input id="myButton"

      type="button" 
      onclick="function1();" 
      value="Tab to put in focus." 
      onFocus="this.innerText="In focus. Click me to lose focus"">

</body> </html>


     </source>
   
  


"blur()" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<a> <acronym> | | |<address> <applet> | | |<area> | | | |

| |
<body> |

| |<button> |

| |
|

| |<custom>

| | | |

| |<dir>
| | |
| | | <embed> | | |<fieldset> | | |<form> <frame> | | |<frameset> <hn> | | |
|

| |<iframe> <img> | | |<input type="button"> <input type="checkbox"> | | |<input type="file"> <input type="image"> | | |<input type="password"> <input type="radio"> | | |<input type="reset"> <input type="submit"> | | |<input type="text"> | | |<isindex> | | |<label> <legend> |

| |
  • <listing> | | |<marquee> <menu> | | |<object>
      | | |

      <plaintext> | | |

                                                            |
      |                |                                                    |
      |                |                                                     |
      |                |<select>                                               |
      |                |                                                |
      |                |                                                 |
      |                |                                                  |
      |                |<tbody>                                                   |
      |                |                             
        | | | window | | |<xmp> | +----------------+--------------------------------------------------------------+ </source>

        "blur()" Syntax, Parameters and Note

        <source lang="javascript"> Note: Element loses focus. The onBlur event is triggered as a result of calling this method.

        Syntax:

        window.blur() document.getElementById("elementID").blur() document.all.elementID.blur() // IE only


        </source>

      |

      | |<textarea> <tfoot> |

      | |
      <thead> | | |