html实现拖拽自定义表单,自定义表单(二)--拖拽(HTML版本)

Gets the type of drag-and-drop operation currently selected or sets the operation to a new type. The value must be

none

copy

link or

move.

获取或者设置当前被选择元素的拖拽类型,它的值必须为none、copy、link、或者move

Provides all of the types of operations that are possible. Must be one of

none,

copy,

copyLink,

copyMove,

link,

linkMove,

move,

all or

uninitialized.

提供所有可能的操作种类,必须是

none

,

copy

,

copyLink

,

copyMove

,

link

,

linkMove

,

move

,

all

或者

uninitialized

.中的一个。

Contains a list of all the local files available on the data transfer. If the drag operation doesn't involve dragging files, this property is an empty list.

包含一组可获取的本地文件列表,如果拖拽操作不包含文件,则这个文件列表将会是空的。这个属性超棒,很多拖拽上传功能就是这样子开发出来的

Gives a

DataTransferItemList object which is a list of all of the drag data.

只读,给定一个

的对象,其中包含了一个所有拖拽数据的列表。

An array of

string giving the formats that were set in the

只读,一组字符串数组,给定了在dragstart事件中设置的一组格式。

Methods

void dataTransfer.clearData([format]);

Remove the data associated with a given type. The type argument is optional. If the type is empty or not specified, the data associated with all types is removed. If data for the specified type does not exist, or the data transfer contains no data, this method will have no effect.

清除给定类别的数据,type这个参数是可选的,如果类别是空或者不明确,跟所有类别相关的数据都将清除掉,如果特定类别的数据不存在,或者dataTransfer不包含数据,则这个方法将没有任何效果。

DOMString dataTransfer.getData(format);

DataTransfer.getData()

Retrieves the data for a given type, or an empty string if data for that type does not exist or the data transfer contains no data.

取回给定类别的数据,如果给定类别的数据不存在或者dataTransfer不包含任何数据,则将返回一个空字符串。

void dataTransfer.setData(format, data);

DataTransfer.setData()

Set the data for a given type. If data for the type does not exist, it is added at the end, such that the last item in the types list will be the new format. If data for the type already exists, the existing data is replaced in the same position.

设置一个给定类别的数据,如果这个类别的数据不存在,则将被添加到末尾,因此这个类别的列表的最后一项将是一个新的格式,如果这个类别已经存在,则存在的数据将被取代为这个新的数据

void dataTransfer.setDragImage(img, xOffset, yOffset);

DataTransfer.setDragImage()

Set the image to be used for dragging if a custom one is desired.      设置拖拽的时候显示的图片(默认是拖拽元素的缩略图)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值