Drag and drop of elements

Source: Internet
Author: User

<!DOCTYPE HTML><HTML><HeadLang= "en">    <title></title>    <MetaCharSet= "Utf-8"></Head><Body>    <ahref= "00_ Show _ Hide toggle. html">Hide Toggle Page</a>    <imgsrc=".. /resource/1.jpg "draggable= "true"ID= "IMG1"/><Scripttype= "Text/javascript">    varIMG1=document.getElementById ("IMG1"); Img1.ondragstart= function(evt) {Evt.dataTransfer.setData ("Text/plan","www.baidu.com"); } document.ondragover= function(evt) {//Cancel the default behavior of an event        return false; } Document.ondrop= function(evt) {img1.style.position= "Absolute"; Img1.style.left=Evt.pagey+"px"; //Cancel Event default behavior        return false; }</Script></Body></HTML><!--1 Set the Draggable property of the element you want to drag to true2 to set the listener for the dragged element -

HTML5 files in the drag-and-drop support or slightly complicated, JS framework should have a better solution

Drag and drop of elements

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.