<script>function allowDrop(ev) {
ev.preventDefault();}function drag(ev) {
ev.dataTransfer.setData("text", ev.target.id);} function drop(ev) {
ev.preventDefault();
var data = ev.dataTransfer.getData("text");
ev.target.appendChild(document.getElementById(data));}</script>
上面的script部分在头之间添加!DOCTYPE HTML html头样式。机身下方
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<div id="drag1" class="drag2" draggable="true" ondragstart="drag(event)" width="336" height="69">Aa</div>
这是实现拖放的正确方法吗?
答案 0 :(得分:0)
创建一个from django.db.models import Func
class Round2(Func):
function = "ROUND"
template = "%(function)s(%(expressions)s::numeric, 2)"
# Then use it as ,e.g.:
# queryset.annotate(ag_roi=Round2("roi"))
# qs.aggregate(ag_sold_pct=Round2(Sum("sold_uts") / (1.0 * Sum("total_uts"))) * 100
标记并复制span
并使用它。请查看代码段。
inner text
#div1 {
border: 1px solid blue;
width: 100px;
height: 100px;
display: inline-box;
overflow-wrap: break-word;
}
#drag1 {
border: 1px solid red;
width: 100px;
height: 100px;
display: inline-box;
overflow-wrap: break-word;
}