【发布时间】:2015-03-24 16:21:40
【问题描述】:
您能告诉我该怎么做吗?任何提示/示例代码将不胜感激。
谢谢, 圈
【问题讨论】:
标签: c# asp.net drag-and-drop
您能告诉我该怎么做吗?任何提示/示例代码将不胜感激。
谢谢, 圈
【问题讨论】:
标签: c# asp.net drag-and-drop
有几种方法可以做到这一点,HTML5 内置了拖放 (D&D)。你可以添加一个 data-attribute 来保存被拖放元素的坐标。
数据属性
<p id="textField" data-coords="0,0">Text</p>
<script>
// 'Getting' data-attributes using getAttribute
var textField= document.getElementById('textField');
var textCoords = plant.getAttribute('data-coords');
// 'Setting' data-attributes using setAttribute
textField.setAttribute('data-coords',);
</script>
这是我在HTML5: dragover(), drop(): how get current x,y coordinates?找到的小提琴
http://jsfiddle.net/kKuqH/2002/
你可以连接dm.style.left + ', ' + dm.style.top
并在textField.setAttribute('data-coords', coords);中设置串联值
您可以从那里获取 ASP.NET 中的数据属性并将其发布到数据库中。
只是一个大纲。
【讨论】: