Anyway, do you have a solution do that please ??

<div id='one'>One</div>
<div id='two'>Two</div>

Then

<div id='one'>Two</div>
<div id='two'>One</div>

???

Or maybe

<div id='position_one'><div ='module_one'>One</div></div>
<div id='position_two'><div ='module_two'>Two</div></div>

Then

<div id='position_one'><div ='module_two'>Two</div></div>
<div id='position_two'><div ='module_one'>One</div></div>

...???

Please

On 6 nov, 17:43, jak0lantash <[EMAIL PROTECTED]> wrote:
> Just a little question : Can I do in the same way like before, and
> just replace the innerHTML code with a kind of thing like next and
> insert ? Like an insert into a div ?
>
> On 6 nov, 17:26, jak0lantash <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > You're right !!!
> > It works fine... Perfect, thank you so much. I though the fault was
> > comming from the innerHTML way, but I hasn't known about this next/
> > insert thing.
> > I think I'm not so good in JavaScript ;)
> > Just a test file :http://www.letroquet.eu/tests/module_inverse.html
> > Now, I have to modify all my code to implement this method.
>
> > Thank you.
>
> > I'll post a link to the site when it'll be finished...
>
> > Take care
>
> > On 6 nov, 15:24, "T.J. Crowder" <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > > 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 ;)
>
> > > I'm pretty sure it will.  Did you try it?  I did a trivial test, and
> > > it worked fine.  Here's my version of moveDown, which differs slightly
> > > from Rob's as it uses Prototype-isms:
>
> > > function moveDown(elm)
> > > {
> > >     var next;
>
> > >     elm = $(elm);
> > >     next = elm.next();
> > >     if (next)
> > >     {
> > >         elm.remove();
> > >         next.insert({after: elm});
> > >     }
>
> > > }
>
> > > That happily moves an element to after its next sibling, if it has
> > > one, retaining its event handlers.  (IE6, FF3, Opera9, Safari 3 for
> > > Windows.)  Complete example:http://pastie.org/308719
>
> > > The problem, as you correctly determined, is that when you use
> > > innerHTML, you're creating *new* element instances to represent the
> > > HTML.  If you just move the elements around, you're not creating new
> > > instances, and the event handlers remain hooked up.
>
> > > If you really want to keep using your innerHTML approach, you'll have
> > > to unhook the handlers before moving things (memory leak otherwise),
> > > then re-hook them afterward.  Note that when re-hooking them, you have
> > > to give the browser a moment to process them using Function.defer or
> > > some such; details on the unofficial 
> > > wiki:http://proto-scripty.wikidot.com/prototype:tip-scripting-dynamically-...
>
> > > But much easier just to move them.
>
> > > HTH,
> > > --
> > > T.J. Crowder
> > > tj / crowder software / com
>
> > > On Nov 6, 1:35 pm, jak0lantash <[EMAIL PROTECTED]> wrote:
>
> > > > 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