当前位置:网站首页>Drag and drop
Drag and drop
2022-06-26 03:22:00 【Small vegetable bird yard live】
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
#box{
width: 300px;
height: 300px;
border: 3px solid red;
}
</style>
</head>
<body>
<img id="img" src="img/musicBtn.png" alt=""/>
<div id="box">
</div>
<script>
var img = document.getElementById('img');
var box = document.getElementById('box');
img.ondragstart = function(e){
console.log(1);
e.dataTransfer.setData('text',this.id);
}
box.ondragover = function(e){
e.preventDefault();// Cancel default event handling
}
box.ondrop = function(e){
var txt = e.dataTransfer.getData('text');
// console.log(txt);
box.appendChild(document.getElementById(txt));
// img.parentNode.removeChild(img);
// box.innerHTML += '<img src="'+txt+'">';
}
</script>
</body>
</html>


边栏推荐
- 【论文笔记】Supersizing Self-supervision: Learning to Grasp from 50K Tries and 700 Robot Hours
- Components and routing
- Cliquez sur le bouton action de la liste pour passer à une autre page de menu et activer le menu correspondant
- Clion项目中运行多个main函数
- USB peripheral driver - Enumeration
- 《你不可不知的人性》经典语录
- GStreamer allocator and pool
- kotlin快速上手
- Good news | congratulations on the addition of 5 new committers in Apache linkage (incubating) community
- Analysis of technological changes in social robots
猜你喜欢

MySQL数据库基础

计组笔记——CPU的指令流水

ArrayList#subList这四个坑,一不小心就中招

【论文笔记】Supersizing Self-supervision: Learning to Grasp from 50K Tries and 700 Robot Hours

云计算基础-0

解析少儿编程的多元评价体系

Overview of orb-slam3 paper

Analysis of the multiple evaluation system of children's programming
HL7Exception: Can‘t XML-encode a GenericMessage. Message must have a recognized struct

Add console programs in UE
随机推荐
网络PXE启动WinPE,支持UEFI和LEGACY引导
双碳红利+基建大年 | 图扑深耕水利水电绿色智能装备领域
小米电视的网页和珠宝的网页
Preparation for wechat applet development
Record a torture bug caused by restcontrol and controller
分割、柱子、list
XGBoost, lightGBM, CatBoost——尝试站在巨人的肩膀上
Modifying table names, deleting tables, obtaining table information, and deleting table records on specified dates for common MySQL statements
[system architecture] - how to evaluate software architecture
经典模型——NiN&GoogLeNet
Analysis of the multiple evaluation system of children's programming
虫子 构造与析构
The "eye" of industrial robot -- machine vision
Components and routing
Overview of orb-slam3 paper
Une citation classique de la nature humaine que vous ne pouvez pas ignorer
scrapy返回400
Review of the paper: unmixing based soft color segmentation for image manipulation
Inkscape如何将png图片转换为svg图片并且不失真
Is it safe to open an online stock account?