Hi,

Thank you for your respons.
Yes I know this possibility. I though about it, but I can not use
it... and I don't think the bind problem will be fix in that way ;)
Because, if in your example, if I take the module-0 code and put it
down between the 1 and 2. The binds will be broken too, aren't they ?

I explain, I wanna use these module on a page like that : at the left
side, several modules (3 per default), at the middle, just the web
pagen at the right side, several modules (3 per default). About
module, I mean a kind of widget.
For every actions on a module, I use two id to identify : a position
id and a module id.
The position id is use for every move action : down, up and delete. I
send an Ajax request. The PHP recognize the position, and the
concerned (with an array job) decide if the action is allowed, and
then the JavaScript finish the job.
The module id is use for every click or refresh action. The same thing
but to matter on the position.
At every moment, I have to now which module is at what position, in
PHP. Therefore, I have a div container for the position and a div
container for the module. So if I insert something somewhere, the
positions ids will be wrong...
I don't know if you understand what I wanna mean. Here is an example :

<div id="position-1"> <!-- BEGIN - div container for the position 1 --
>
  <div id="module-A"> <!-- BEGIN - div container for the module A -->
    text and javascript for the widget A
  </div> <!-- BEGIN - div container for the module A -->
</div> <!-- BEGIN - div container for the module 1 -->

<div id="position-2"> <!-- BEGIN - div container for the position 2 --
>
  <div id="module-B"> <!-- BEGIN - div container for the module B -->
    text and javascript for the widget B
  </div> <!-- BEGIN - div container for the module B -->
</div> <!-- BEGIN - div container for the module 2 -->

If I insert something between those two modules, the positions ids
will be wrong...
Do you understand ?

Thanks, bye

On 6 nov, 01:22, RobG <[EMAIL PROTECTED]> wrote:
> I think that your solution is way to complex for what you are doing.
> If all you want to do is swap the position of the divs, insert the one
> that you want to move down as the next sibling of the one below it (if
> there is one) - i.e. the nextSibilng of its nextSibling.
>
> e.g.
>
> <script type="text/javascript">
>
> function moveDown(el) {
>   var div = el.parentNode;
>   var nextSib = div.nextSibling;
>   while (nextSib && nextSib.nodeType != 1) {
>     nextSib = nextSib.nextSibling;
>   }
>   if (nextSib) {
>     div.parentNode.insertBefore(div, nextSib.nextSibling);
>   }
>
> }
>
> </script>
>
> <div id="container">
>  <div id="module-0">
>   <button onclick="moveDown(this);">Move Down A</button>
>  </div>
>
>  <div id="module-1">
>   <button onclick="moveDown(this);">Move Down B</button>
>  </div>
>
>  <div id="module-2">
>   <button onclick="moveDown(this);">Move Down C</button>
>  </div>
> </div>
>
> --
> Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to