标签:style io ar sp java on div art bs
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> #div1, #div2 {float:left; width:100px; height:35px; margin:10px;padding:10px;border:1px solid #aaaaaa;} </style> <script type="application/javascript"> function drag(ev){ ev.dataTransfer.setData("Text",ev.target.id); } function allowDrag(en){ en.preventDefault(); } function drop (en) { en.preventDefault(); var data=en.dataTransfer.getData(‘Text‘); en.target.appendChild(document.getElementById(data)) } </script> </head> <body> <div id="div1" ondrop="drop(event)" ondragover="allowDrag(event)"> <img src="123.jpg" width="80" height="80" draggable="true" ondragstart="drag(event)" id="drag2"> </div> <div id="div2" ondrop="drop(event)" ondragover="allowDrag(event)"></div> </body> </html>
标签:style io ar sp java on div art bs
原文地址:http://my.oschina.net/u/1169079/blog/353433