function?getByClass?(clsName,parent)?{
var?oparent=parent?document.getElementById(parent):document;
eles=[],
elements=oparent.getElementsByTagName('*')
for?(var?i?=?0,l=elements.length;i<l;i++)?{
?????if(elements[i].className==clsName){eles.push(elements[i])}
};
return?eles
}
window.onload=drag;
function?drag()?{
var?otitle=getByClass('login_logo_webqq','loginPanel')[0];
otitle.onmousedown=fnDown;
}
function?fnDown(event){
??event?=?event?||?window.event;
??var?oDrag=document.getElementById('loginPanel'),
??????//?光標(biāo)按下時光標(biāo)和面板之間的距離
??????disX=event.clientX-oDrag.offsetLeft,
??????disY=event.clientY-oDrag.offsetTop;
????????//?移動
??????document.onmousemove=function(event){
???????? event?=?event?||?window.event;
???????? fnMove(event,disX,disY);
???????}
}
function?fnMove(e,posX,posY){
var?oDrag=document.getElementById('loginPanel'),
??????l=e.clientX-posX,
??????t=e.clientY-posY,
????oDrag.style.left=l+'px'
?????oDrag.style.top=t+'px'
}
我想問我這段代碼錯在哪里啊,怎么操作不了?
幕布斯6906120
2016-01-27 17:28:41