#drag {: absolute;
left: 100px;
top: 100px;
width: 100px;
height: 100px;d-color: #f00;ove;
}
ententById(‘drag’);ouseXouseY, offsetX, offsetY;
tListenerousedownction(e) {ouseXtX;ouseYtY;
offsetX=drag.offsetLeft;
offsetY=drag.offsetTop;enttListenerousemoveousemoveHandler);enttListenerouseupouseupHandler);
});
ctionousemoveHandler(e) {tXouseX + ‘px’;tYouseY + ‘px’;
}
ctionouseupHandler() {entoveEventListenerousemoveousemoveHandler);entoveEventListenerouseupouseupHandler);
}