来回拖动图片代码(HTML)

Contributor:在二次元打字 Type:代码 Date time:2020-09-15 17:19:14 Favorite:23 Score:0
返回上页 Report
请选择举报理由:




Collection Modify the typo
<!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>
声明:以上文章均为用户自行添加,仅供打字交流使用,不代表本站观点,本站不承担任何法律责任,特此声明!如果有侵犯到您的权利,请及时联系我们删除。
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

登录后可见