javascript实现的元素拖动函数宿主为浏览器
//宿主为浏览器 //将相应的元素对象的引用传到函数中 function candrag(drager) { drager.onmousedown = function (down) { var offx = drager.offsetLeft var offy = drager.offsetTop; var offxl = down.clientX - offx; var offyl = down.clientY - offy; window.condition = 0;//为window添加了condition属性,用于解决和click之间的矛盾