onmouseup event's target in NS6/7
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mark_Ivs
Posted On:   Monday, April 28, 2003 03:43 PM

var dragElement; function getDraggableElement (target) { do if (target.className == 'dragDiv') return target; while ((target = target.parentNode)); return null; } function dragStart (e) { dragElement = getDraggableElement (e.target); if (dragElement) { document.onmousemove = dragOn; document.onmouseup = dragEnd; } } function dragOn (e) { dragElement.style.left = e.clientX + 'px'; dragElement.style.top = e.clientY + 'px'; } function dragEnd (evt) { window.alert(evt.target.id); document.onmousemove = null; document.onmouseup = null; dragElement = null; } document.onmousedown = dragStart; ]]>]]> This is a NS6 related question. I drag a div and drop it on a table row. When I drop the div I want to find out which row I drop that div on.    More>>

This is a NS6 related question. I drag a div and drop it on a table row. When I drop the div I want to find out which row I drop that div on.


How do I do that ? Right now with my code'onmouseup' event always returns the id of the div instead of id of the row I dropped on.


Please take a look at the code. You can copy it and test it too if you want.


Your help will be greatly appreciated.


Thanks.
Mark

			


.dragDiv {position: absolute;}
#dragOne {border: 1px solid gray;}




This is the dragable text










Row One
Row Two



   <<Less
About | Sitemap | Contact