HTML5拖放问题在Internet Explorer(dataTransfer属性访问不可能) [英] HTML5 Drag&Drop issue in Internet Explorer (dataTransfer property access not possible)

查看:284
本文介绍了HTML5拖放问题在Internet Explorer(dataTransfer属性访问不可能)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用HTML5实现基本的拖放功能。它在Chrome中工作得很好,但在IE10中,我得到一个 0x8000ffff - JavaScript运行时错误:意外调用方法或属性访问。行中的错误 setData

  function handleDragStart(e){
e.dataTransfer.effectAllowed =移动';
e.dataTransfer.setData(dropTarget,g.destination);
}

var cols = $(#+ g.source +tbody> tr);
[] .forEach.call(cols,function(col){
col.addEventListener('dragstart',handleDragStart,false);
});

我做错了什么?

解决方案

对于那些正在寻找答案的人:



getData()和setData()属性必须完全调用text因为你可以在其他浏览器中使用任何参数(实际上很有意义 - IE再次摇滚),这些其他答案是无用的。


I'm trying to implement basic drag&drop functionality with HTML5. It works totally fine in Chrome, but in IE10 I get an 0x8000ffff - JavaScript runtime error: Unexpected call to method or property access. error in the line setData.

function handleDragStart(e) {
    e.dataTransfer.effectAllowed = 'move';                                        
    e.dataTransfer.setData("dropTarget", g.destination);
}

var cols = $("#" + g.source + " tbody > tr");
[].forEach.call(cols, function (col) {
    col.addEventListener('dragstart', handleDragStart, false);
});

What am I doing wrong?

解决方案

For those who are looking for an answer:

getData() and setData() attribute must be called exactly "text", since u can use any parameter in other browsers (which actualy makes lot of sense - IE rocks again), those other answers here are useless.

这篇关于HTML5拖放问题在Internet Explorer(dataTransfer属性访问不可能)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆