来回拖动图片代码(HTML)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<style type="text/css">
#div1, #div2
{
float:left;
width:100px;
height:35px;
margin:10px;
padding:10px;
border:1px solid #aaaaaa;
}
</style>
<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>
</head>
<body>
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)">
</div>
<div id="div2" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<img src="img_w3slogo.gif" draggable="true" ondragstart="drag(event)"
id="drag1" width="88" height="31">
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<style type="text/css">
#div1, #div2
{
float:left;
width:100px;
height:35px;
margin:10px;
padding:10px;
border:1px solid #aaaaaa;
}
</style>
<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>
</head>
<body>
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)">
</div>
<div id="div2" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<img src="img_w3slogo.gif" draggable="true" ondragstart="drag(event)"
id="drag1" width="88" height="31">
</body>
</html>
Last one:Good Study Habits
Next one:阴人墓 一百八十章 游戏
声明:以上文章均为用户自行添加,仅供打字交流使用,不代表本站观点,本站不承担任何法律责任,特此声明!如果有侵犯到您的权利,请及时联系我们删除。
Hot degree:★☆☆☆☆
Difficulty:☆☆☆☆☆
quality:☆☆☆☆☆
Description: the system according to the heat, the difficulty, the quality of automatic certification, the certification of the article will be involved in typing!
This paper typing ranking TOP20
登录后可见
用户更多文章推荐
- 二次元的都给我进来2021-05-30
- 前端表格练习2020-09-14
- java jdbc的连接数据库的使用2020-08-06
- 数据库基本知识2020-08-06
- 卢本伟牛逼2024-03-05
- 六月的雨(纯手打 空格节奏,适合边听边...2020-07-02
- 编程必备训练2020-06-27
- C语言单词表及解释(开头为英文)2020-06-24
- 半岛铁盒2020-06-19
- 灌篮高手体会(强力推荐动漫)2020-06-19
- 女孩(中文版无标点)2020-06-16
- 爸爸的花儿落了(末尾片段)2020-06-14
- 七里香(中文版无标点)2020-06-14
- 程序员打字必备2020-06-10
- something(无任何大小写和标点)2020-06-07
- 明明就(中文版无标点)2020-06-07