libsfan01 a écrit :
hi all
im looking for help on how you can track the order of elements in a
parent div when these elements are dragable (with scriptaculous)?
Does drag-&-drop change order of these elements, or does that only
change their position ? (styles top, left ... z-index )
I tihnk i need to write a function that is called everytime i drag
something, that works out the order of elements in a div.
Certainly yours elements know themselves where (which position) they
are, you only have to ask them : "where are you ?".
how would i iterate over the child elements of a
div retrieving their id's in an array.
Array of divs direct children of a div
childs = new Array();
var c = document.getEle mentById('myDiv ').getElementsB yTagName('DIV') ;
var k = 0;
for(var i=0; i<c.length; i++)
if('myDiv' == c[i].parentNode.id) {
childs[k] = c[i].id;
k++;
}
alert(childs);
Array of all elements direct children of a div
childs = new Array();
var c = document.getEle mentById('myDiv ').getElementsB yTagName('*');
var k = 0;
for(var i=0; i<c.length; i++)
if('myDiv' == c[i].parentNode.id) {
childs[k] = c[i].id;
k++;
}
alert(childs);
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date