JavaScript Reference/Javascript Objects/dataTransfer — различия между версиями

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

Текущая версия на 08:22, 26 мая 2010

"dataTransfer" Example

    
<html>
<head>
<script language="JavaScript">
function transferDrop() {
    window.event.srcElement.innerText = window.event.dataTransfer.getData("text");
    window.event.returnValue = false; 
} 
function transferDrag() { 
    window.event.dataTransfer.dropEffect = "move"; 
    window.event.returnValue = false; 
} 
</script>
</head>
<body>
<p id="mySource" 
   ondragstart="window.event.dataTransfer.effectAllowed = "move";">
   Highlight text in this paragraph and drag it to the text area below
</p>
<textarea id="myTarget" 
          ondrop="transferDrop();" 
          ondragover="window.event.returnValue = false;" 
          ondragenter="transferDrag();">
</textarea>
</body>
</html>



"dataTransfer" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |event                                                         |
+----------------+--------------------------------------------------------------+



"dataTransfer" JavaScript Methods

+----------------+--------------------------------------------------------------+
| JavaScript     |clearData                       getData                       |
| Methods        |setData                                                       |
+----------------+--------------------------------------------------------------+



"dataTransfer" JavaScript Properties

+----------------+--------------------------------------------------------------+
| JavaScript     |dropEffect                      effectAllowed                 |
+----------------+--------------------------------------------------------------+



"dataTransfer" Syntax and Note

Note:
Access to clipboard data formats used in drag-and-drop operations.
    
Syntax:
    
event.dataTransfer.memberName