JavaScript Reference/Event Handlers Reference/onDrag

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

"onDrag" Example

    
<html>
<head>
<script language="JavaScript">
<!--
function function1() {
  msg = "on" + event.type + " event fired by " + """ + event.srcElement.id + """; 
  alert(msg+"\nPress Enter twice to close this window") 
} 
--> 
</script>
</head>
<body bottommargin=150>
  <p>Source object: 
<input id="sourceObject" size=50 value="The text to Drag" ondrag="function1()">
<br>
  </p>
  <p>Drop selected text into the following text field.</p>
  Target object: 
<input id="targetObject" size=50 value="Drag destination element"> 
</body>
</html>



"onDrag" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<a>                             <acronym>                     |
|                |<address>                       <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>                           |
|                |<img>                           <input type="button">         |
|                |<input type="checkbox">         <input type="file">           |
|                |<inputtype="image">             <input type="password">       |
|                |<input type="radio">            <input type="reset">          |
|                |<input type="submit">           <input type="text">           |
|                |<kbd>                           <label>                       |
|                |<li>                            <listing>                     |
|                |<map>                           <marquee>                     |
|                |<menu>                          <nobr>                        |
|                |<object>                        <ol>                          |
|                |<option>                        <p>                           |
|                |<pre>                           <q>                           |
|                |<s>                             <samp>                        |
|                |<select>                        <small>                       |
|                |<span>                          <strike>                      |
|                |<strong>                        <sub>                         |
|                |<sup>                           <table>                       |
|                |<tbody>                         <td>                          |
|                |<textarea>                      <tr>                          |
|                |<tt>                            <u>                           |
|                |<ul>                            <var>                         |
|                |<xmp>                                                         |
+----------------+--------------------------------------------------------------+



"onDrag" Properties

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



"onDrag" Syntax and Note

Note:
    
This event fires continuously while an object is being dragged. 
The object must support drag-and-drop.