我们的志愿者还没有将这篇文章翻译为 中文 (简体)。加入我们帮助完成翻译
您也可以阅读此文章的English (US)版。
Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
The DataTransfer.mozItemCount
property returns the number of items being dragged. This can be used, for example, to get the number of files being dragged.
This property is Read only .
Syntax
dataTransfer.mozItemCount;
Return value
A number
representing the number of items being dragged.
Example
This example shows the use of the mozItemCount
property.
function drop_handler(event) { var files = []; var dt = event.dataTransfer; for (var i = 0; i < dt.mozItemCount; i++) files.push(dt.mozGetDataAt("application/x-moz-file", i)); }
Specifications
This property is not defined in any Web standard.
Browser compatibility
Desktop | Mobile | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Basic support | Chrome No support No | Edge No support No | Firefox Full support Yes | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Edge Mobile No support No | Firefox Android ? | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.
- Experimental. Expect behavior to change in the future.
- Non-standard. Expect poor cross-browser support.
- Non-standard. Expect poor cross-browser support.