好的,我设置了一个元素来接收文件放置事件,但是当我查看 event.dataTransfer 时,它是空白的.我还没有开始学习拖放式 HTML5 API,而且对它还有点迷糊.我正在我的网站 上处理它.如果您不介意浏览我的代码并查看发生了什么,我们将不胜感激.正在记录整个 event 对象.
Okay, I have an element set up to receive a file-drop event, but when I look in event.dataTransfer it is blank. I haven't gotten around to learning the drag-n-drop HTML5 API just yet and am still a little foggy on it. I'm working on it at my site. If you wouldn't mind poking around my code and seeing what's going on, it would be highly appreciated. The entire event object is being logged.
它工作正常,只是控制台的一个错误.
It's working fine, it's just a bug with the console.
function onDrop(event) {
event.preventDefault();
console.log(event.dataTransfer.files[0]);
}
这篇关于触发 ondrop 时 event.dataTransfer.files 为空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在 javascript 认为文档“准备好"之前,如何让How can I get my jasmine tests fixtures to load before the javascript considers the document to be quot;readyquot;?(在 javascript 认为文档“准备好
jasmine 运行和等待实际上是做什么的?What do jasmine runs and waitsFor actually do?(jasmine 运行和等待实际上是做什么的?)
如何提供模拟文件来更改 <input type='filHow to provide mock files to change event of lt;input type=#39;file#39;gt; for unit testing(如何提供模拟文件来更改 lt;input type=filegt; 的事
如何使用 Jasmine 对链式方法进行单元测试How to unit test a chained method using Jasmine(如何使用 Jasmine 对链式方法进行单元测试)
如何将 $rootScope 注入 AngularJS 单元测试?How do I inject $rootScope into an AngularJS unit test?(如何将 $rootScope 注入 AngularJS 单元测试?)
Jasmine - 如何监视函数中的函数调用?Jasmine - How to spy on a function call within a function?(Jasmine - 如何监视函数中的函数调用?)