翻譯不完整。請協助 翻譯此英文文件。
DataEvent.dataTransfer
屬性保留了拖曳操作中的資料(指向一個 DataTransfer
物件)。
此屬性為 Read only 。
語法
var data = dragEvent.dataTransfer;
回傳值
data
- 一個保存
DragEvent
當中資料的DataTransfer
物件。
範例
This example illustrates accessing the drag and drop data within the dragend
event handler.
function process_data(d) { // Process the data ... } dragTarget.addEventListener("dragend", function(ev) { // Call the drag and drop data processor if (ev.dataTransfer != null) process_data(ev.dataTransfer); }, false);
規範
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of 'DragEvent.dataTransfer' in that specification. |
Living Standard | |
HTML5.1 The definition of 'DragEvent.dataTransfer' in that specification. |
Working Draft | Initial definition |
瀏覽器相容性
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 4 | 3.5 (1.9.1) | 10 | 12 | 3.1 |
Feature | Android | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|---|
Basic support | No support | No support | No support | No support | No support | 10 | No support | No support |