<body>
<div id="content">
<div id="source">
<div id="touch-source" draggable="true" ondragstart="drag(event)">
<span class="title">景点</span>
</div>
</div>
<div id="target" ondrop="drop(event)" ondragover="allowDrop(event)">
</div>
</div>
<script>
function drag(ev){
ev.dataTransfer.setData("Text",ev.target.id);
};
function allowDrop(ev){
ev.preventDefult();
};
function drop(ev){
ev.preventDefault();
var data = ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
};
</script>
</body>
报错:TypeError: ev.preventDefult is not a function
相关分类