Although I agree that the library is the way to go, the answer you want is onmousedown, onmousemove, onmouseup. You must handle these three events.
In onmousedown you will find the target (event.target or similar in different browsers) and set draggedObject = event.target. You will also start to handle the onmousemove event.
Whenever the onmousemove event fires, you move the dragged item based on the difference in position, since the last time the onmousemove event fires.
In the onmouseup event, you clear the draggedObject variable and stop processing onmousemove.
This is not a very cross-browser, but it is the core of what you need to do to drag and drop.
Adam a
source share