JavaScript Reference/Event Handlers Reference/onFocus

Материал из Web эксперт
Версия от 08:22, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"onFocus" Example

    
<head>
<script language="JavaScript">
function function1() {
    document.getElementById("myL").blur();
    alert("<A> element has received focus.");
    window.open("http://www.wbex.ru", "", ""); 
}
</script>
</head>
<body>
<a id="myL" 
   href="http://www.wbex.ru/" 
   target=_blank 
   onFocus="function1()">
    www.wbex.ru
</a>
</body>



"onFocus" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<a>                             <acronym>                     |
|                |<address>                       <applet>                      |
|                |<area>                          <b>                           |
|                |<bdo>                           <big>                         |
|                |<blockquote>                    <body>                        |
|                |<button>                        <caption>                     |
|                |<center>                        <cite>                        |
|                |<custom>                        <dd>                          |
|                |<del>                           <dfn>                         |
|                |<dir>                           <div>                         |
|                |<dl>                            <dt>                          |
|                |<em>                            <embed>                       |
|                |<fieldset>                      <font>                        |
|                |<form>                          <frame>                       |
|                |<frameset>                      <hn>                          |
|                |<hr>                            <i>                           |
|                |<iframe>                        <img>                         |
|                |<input type="button">           <input type="checkbox">       |
|                |<input type="file">             <input type="hidden">         |
|                |<input type="image">            <inputtype="password">        |
|                |<input type="radio">            <input type="reset">          |
|                |<inputtype="submit">            <input type="text">           |
|                |<ins>                           <isindex>                     |
|                |<kbd>                           <label>                       |
|                |<legend>                        <li>                          |
|                |<listing>                       <map>                         |
|                |<marquee>                       <menu>                        |
|                |<object>                        <ol>                          |
|                |<optgroup>                      <option>                      |
|                |<p>                             <pre>                         |
|                |<q>                             <rt>                          |
|                |<ruby>                          <s>                           |
|                |<samp>                          <select>                      |
|                |<small>                         <span>                        |
|                |<strike>                        <strong>                      |
|                |<sub>                           <sup>                         |
|                |<table>                         <tbody>                       |
|                |<td>                            <textarea>                    |
|                |<tfoot>                         <th>                          |
|                |<thead>                         <tr>                          |
|                |<tt>                            <u>                           |
|                |<ul>                            <var>                         |
|                |window                          <xmp>                         |
+----------------+--------------------------------------------------------------+



"onFocus" Properties

+----------------+--------------------------------------------------------------+
| Properties     |altKey                          altLeft                       |
|                |clientX                         clientY                       |
|                |ctrlLeft                        offsetX                       |
|                |offsetY                         returnValue                   |
|                |screenX                         screenY                       |
|                |shiftLeft                       srcElement                    |
|                |type                            x                             |
|                |y                                                             |
+----------------+--------------------------------------------------------------+



"onFocus" Syntax and Note

Note:
    
This event fires when the element on the page receives focus.