js:
var posX; posY;
fdiv = document.getElementById("divBody");
document.getElementById("divHead").onmousedown=function(e)
{
if(!e) e = ウィンドウ。イベント; / /IE
posX = e.clientX - parseInt(fdiv.style.left);
posY = e.clientY - parseInt(fdiv.style.top);
}
document.onmouseup = function()
{
document.onmousemove = null;
}
function Mousemove(ev)
{
if(ev= =null) ev = window.event;//IE
fdiv.style.left = (ev.clientX - posX) "px";
fdiv.style.top = (ev.clientY - posY) "px ";
}
html:
🎜>
css :