JavaScript Reference/Event Handlers Reference/onKeyUp

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

"onKeyUp" Example

    
<html>
<head>
<script language="JavaScript">
function function1() {
    msg = "on" + event.type + " event fired by " + """ + event.srcElement.id + """; 
    alert(msg) 
} 
</script></head>
<body id="myBody" onkeyup="function1()">
<p>Press any key to fire the event</p>
</body>
</html>



"onKeyUp" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<a>                             <acronym>                     |
|                |<address>                       <applet>                      |
|                |<area>                          <b>                           |
|                |<bdo>                           <big>                         |
|                |<blockquote>                    <body>                        |
|                |<button>                        <caption>                     |
|                |<center>                        <cite>                        |
|                |<code>                          <custom>                      |
|                |<dd>                            <del>                         |
|                |<dfn>                           <dir>                         |
|                |<div>                           <dl>                          |
|                |document                        <dt>                          |
|                |<em>                            <fieldset>                    |
|                |<font>                          <form>                        |
|                |<hn>                            <hr>                          |
|                |<i>                             <input type="button">         |
|                |<input type="checkbox">         <input type="file">           |
|                |<input type="image">            <input type="password">       |
|                |<input type="radio">            <inputtype="reset">           |
|                |<input type="submit">           <input type="text">           |
|                |<ins>                           <kbd>                         |
|                |<label>                         <legend>                      |
|                |<li>                            <listing>                     |
|                |<map>                           <marquee>                     |
|                |<menu>                          <nobr>                        |
|                |<noframes>                      <noscript>                    |
|                |<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>                         |
|                |<xmp>                                                         |
+----------------+--------------------------------------------------------------+



"onKeyUp" Properties

+----------------+--------------------------------------------------------------+
| Properties     |altKey                          altLeft                       |
|                |cancelBubble                    clientX                       |
|                |clientY                         ctrlKey                       |
|                |ctrlLeft                        keyCode                       |
|                |offsetX                         offsetY                       |
|                |repeat                          returnValue                   |
|                |screenX                         screenY                       |
|                |shiftKey                        shiftLeft                     |
|                |srcElement                      type                          |
|                |x                               y                             |
+----------------+--------------------------------------------------------------+



"onKeyUp" Syntax and Note

Note:
    
This event fires when the user releases any key on the keyboard.