0

Hi,I am using dhtml goodies js file for drag and drop.i have to pass sourceid for the function in js file.

        addSource : function(sourceId,slideBackAfterDrop,xAxis,yAxis,dragOnlyWithinElId,functionToCallOnDrag)
    {
            if(!functionToCallOnDrag)functionToCallOnDrag=false;
            if(!this.dragDropSourcesArray)this.dragDropSourcesArray = new Array();
            if(!document.getElementById(sourceId))alert('The source element with id ' + sourceId + ' does not exists');
            var obj = document.getElementById(sourceId);

            if(xAxis!==false)xAxis = true;
            if(yAxis!==false)yAxis = true;

            this.dragDropSourcesArray[this.dragDropSourcesArray.length]  = [obj,slideBackAfterDrop,xAxis,yAxis,dragOnlyWithinElId,functionToCallOnDrag];    
            obj.setAttribute('dragableElement',this.dragDropSourcesArray.length-1);
            obj.dragableElement = this.dragDropSourcesArray.length-1;

        }

        I have to pass id for dynamically created elemets so for that i did a code like this,



     <div  class="dragableBox" ondrag="add1(this.id)"   id="<%=rs_list_task1.getString("task_id")%>" >
     function add1(id)
{
var dragDropObj = new DHTMLgoodies_dragDrop();
dragDropObj.addSource(id,true,true,true,false,'onDragFunction');

}

if i give static like this dragDropObj.addSource('324',true,true,true,false,'onDragFunction'); its working..how could i pass id of dynamically created div's to this function...

2
Contributors
1
Reply
12
Views
2 Years
Discussion Span
Last Post by Taywin
0

It depends on how you pass in the id. By the way, are you using Ruby or JSP? If so, you need to escape the double quote id="<%=rs_list_task1.getString(\"task_id\")%>"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.