[英]Drag and drop not working in chrome
Iam trying to use drag and drop. 我正在尝试使用拖放功能。 In an anchor tag I write my onsdragstart event as written down
在锚标记中,我写下了onsdragstart事件
<a href="xyz.action" ondragstart="event.dataTransfer.setData('text/uri-list', 'abc.action?id=2')">drag</a>
Im trying to drop the item in a div 我正在尝试将该项目放入div中
<div id="ccc" ondragover="event.preventDefault()" ondrop="doDrop1(event)"></div>
My javascript is as below: 我的JavaScript如下:
function doDrop1(event)
{
document.getElementById("mylock").value=1;
var links = event.dataTransfer.getData("text/uri-list").split("\n");
alert(links)
}
In chrome the alert is 'http://localhost:8084/test/xyz.action'
In firefox i'm getting correct alert as 'abc.action?id=2'
在Chrome中,警报为
'http://localhost:8084/test/xyz.action'
在Firefox中,我收到的警报为'abc.action?id=2'
在“ event.dataTransfer.setData()”中,将数据格式用作“文本”,而不是“文本/ uri-list”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.