Drag-and-Drop from one cell to another

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Drag-and-Drop from one cell to another

Post by anjanesh »

I have 2 tables - ids t1 and t2, each having just one cell.
t1 has some text content in it.

1. Is there a way to 'drag-and-drop' the t1's contents to t2 ? Or would I need to code the mousedown and mouseup events for this ?

2. If coding mouse events is the only option then would it possible to have the text not selected. Because the cell contains text, when I drag and move the text gets selected - any way to stop this ?

Thanks
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Not sure with text but perhaps looking over the code at http://www.walterzorn.com/ might help ;)
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Mozilla's specific CSS -moz-user-select doesnt allow user to select the text.
Coming in CSS3 as user-select - this is long way to go.
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

I am thinking like...you get the co-ordinates of all tables or divs in a page.
try to move an image out of the source div and during the mouse out event find the co-ordinates of the cursor.
try to match the co-ordinates with the co-ordinates you have of all divs or tables.
if you find a match and if thats a container for sure, you can now use innerHTML for div / dynamically create tr, td to copy the text to the destination.
Post Reply