systemdraganddropexample6.htm
来自「这是javascript高级程序设计的源码」· HTM 代码 · 共 29 行
HTM
29 行
<html>
<head>
<title>System Drag And Drop Example</title>
<script type="text/javascript">
function handleDragDropEvent(oEvent) {
switch(oEvent.type) {
case "dragover":
case "dragenter":
oEvent.returnValue = false;
break;
case "drop":
alert(oEvent.dataTransfer.getData("text"));
}
}
</script>
</head>
<body>
<p>Try dragging the text from the textbox to the red square.
It will show you the selected text when dropped.</p>
<p><input type="text" value="drag this text" />
<div style="background-color: red; height: 100px; width: 100px"
ondragenter="handleDragDropEvent(event)"
ondragover="handleDragDropEvent(event)"
ondrop="handleDragDropEvent(event)"></div></p>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?