This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Website Design Forum > August 2007 > ~~~Swap list help!!!~~~





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author ~~~Swap list help!!!~~~
Shalom1810

2007-08-25, 5:06 pm

I have this code:

<SCRIPT>
function fnSwap(){
oList.children(0).swapNode(oList.children(1)); oList.children(2).swapNode(oList.children(3));
}
</SCRIPT>

<UL ID = oList>
<LI>List Item 1
<LI>List Item 2
<LI>List Item 3
<LI>List Item 4
</UL>
<INPUT TYPE = button VALUE = "Swap List" onclick = "fnSwap()">

But I need a code that will take my list and, when a button is clicked, re-order it, but if a second button is clicked it will order THE SAME LIST in a different way.
This code is the best I've found so far, and it isn't working very good. Untill I find a better one, I'm gonna have to use the same code, but it will need some major changes--And I don't know how to make them.

So...

(#1) I was wondering how I can have this code only swap things once, instead of each time they push the button.

(#2) Say I want one button to switch list item 1 and 2. And another button to switch list item 3 and 4. How do I do that while still using the same list.

(#3) Is there a way I can choose what order they go in instead of having to swap them?

And (#4(the most important questions of all)
Is there a better code I could use to achieve this? If you can think of one I could use, It would be GREATLY appriciated!!!
Sponsored Links


Copyright 2003 - 2009 forum4designers.com  Software forum  Computer Hardware reviews