问题
I put this code in a test HTML file:
<head>
<script>
f=function() {
el=document.getElementById('dragdiv');
el.ondragover=function(){return false;};
el.ondragenter=function(){return false;};
el.ondrop=function(event){
el.innerHTML=event.dataTransfer.getData('Text');};
}
</script>
</head>
<body onload='f()'>
<div id='dragdiv'>DROP HERE ------------------------</div>
<img src='image.jpg'></img>
(Tags were removed) It works in Chrome but not in Opera and Safari because the mouse cursor does not change into an arrow like in Chrome. What is wrong with this code in Opera and Safari?
回答1:
Drag and drop support is coming in Opera 12, which is now out in beta. As far as I can tell, it works in the beta release.
来源:https://stackoverflow.com/questions/10411970/dragdrop-not-working-in-opera-11-62-and-safari-5-1-4