当前位置:网站首页>拖放
拖放
2022-06-26 02:49:00 【小菜鸟码住】
<!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();//取消默认事件处理
}
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>


边栏推荐
- How to prompt
- Add console programs in UE
- Use annotationdbi to convert gene names in R
- Camtasia 2022 new ultra clear recording computer video
- 2022年挖财证券开户安全嘛?
- Survival analysis based on ovarian data set
- [system architecture] - how to evaluate software architecture
- 国信金太阳靠谱吗?开证券账户安全吗?
- Oracle exercise
- The role of children's programming in promoting traditional disciplines in China
猜你喜欢

【哈希表】改进,拉链法哈希结构——直接用两个索引查找,不用每次都hash和%一遍

学习太极创客 — MQTT(五)发布、订阅和取消订阅

浅谈虚拟内存与项目开发中的OOM问题

Drawing structure diagram with idea

丝网印刷的种类及其应用方法

《你不可不知的人性》經典語錄

How to add a regression equation to a plot in R

Utonmos: digital collections help the inheritance of Chinese culture and the development of digital technology

MySQL增删查改(初阶)

计组笔记——CPU的指令流水
随机推荐
【论文笔记】Manufacturing Control in Job Shop Environments with Reinforcement Learning
gstreamer分配器与pool的那些事
js array数组json去重
Redis configuration and optimization of NoSQL
Mysql常用sql语句之修改表名、删除表、获取表信息、删除指定日期的表记录
Record a torture bug caused by restcontrol and controller
【解决】联想拯救者vmware启动虚拟机蓝屏重启问题
Clion项目中运行多个main函数
Learn from Taiji makers - mqtt (V) publish, subscribe and unsubscribe
【哈希表】改进,拉链法哈希结构——直接用两个索引查找,不用每次都hash和%一遍
Utonmos: digital collections help the inheritance of Chinese culture and the development of digital technology
Oracle exercise
Analysis and optimization of ue5 global illumination system lumen
Hardware creation principle of campus maker space
Camtasia 2022全新版超清錄制電腦視頻
The "more" option of Spreadtrum platform dearmcamera2 is removed
scrapy返回400
Interpreting Oracle
计组笔记 数据表示与运算 校验码部分
Components and routing