拖拽事件_2
阿新 • • 發佈:2017-05-07
log || spa agen onload win close list pre
-
1 *{margin: 0;padding: 0;} 2 li{list-style: none; 3 height: 30px; 4 width: 100px; 5 margin: 10px; 6 background-color: yellow;} 7 #div1{ 8 margin: 100px; 9 height: 100px; 10 width: 100px; 11 background-color: red; 12 }
View Code1 window.onload=function(){ 2 var oUl=document.querySelector("ul"); 3 var aLi=document.getElementsByTagName(‘li‘); 4 var oDiv=document.getElementById("div1"); 5 var i=0; 6 for(var i=0;i<aLi.length;i++){ 7 aLi[i].index=i; 8 aLi[i].ondragstart=function(ev){
View Code - b
- c
拖拽事件_2