Saturday, March 24, 2012

Need code for Drag and Drop Div ...

Hello All...

i have two tables where i have 3 div in 1 one table and 3 Divs in other table.

i want that i can drag any DIV of 1st tables DIV to 2nd TABLES Div and can paste on it..

i went to several solutions but they are providing solutions for HardCord Named DIVS not for Runtime Created DIVs.

pls help me...

It shouldn't work any differently. You just need to assign IDs to the divs when you create them and then assign the behaviors to those IDs. Perhaps if you post the code you are using to create the divs as well as what solution you want to use (I personally like the prototypes at http://script.aculo.us).


Yes. Check these sample for clues

http://www.codeproject.com/aspnet/DragAndDropShopping.asp

http://elouai.com/javascript-drag-and-drop.php

HTH,
Suprotim Agarwal

--
http://www.dotnetcurry.com
--


i am basically creatingDIV dynamically through CODE and i want to paste them on each other

i am not getting any help from http://script.aculo.us site and other answers of my post forums

How can i assign values & Ids of different DIV created at runtime in my JavaScript ?? can u give me a sample code ...

Thank You


var parent = document.getElementById('parentDiv');
var newdiv = document.createElement('div');
var divID = 'myNewDiv;
newdiv.setAttribute('id',divID);
newdiv.innerHTML = 'Element has been added!';
parent.appendChild(newdiv);


http://www.dhtmlgoodies.com/index.html?page=dragDrop

No comments:

Post a Comment