Click to See Complete Forum and Search --> : how do i tackle..


johnn
03-27-2003, 08:01 AM
Im just getting to grips with javascript with almost no past knowledge on any language, and need to write something that will alow me to sort a selection of several images into any order a person desires by moving the selected image to the top of the list and moving all other images down accordingly. Code isn't necessary (i need to learn sometime) but directions/pointers on how I would tackle this would be greatly appreciated.

thanks.

khalidali63
03-27-2003, 08:23 AM
Here is one way of doing this.

create an array of all images,
display them in a list box.
get the value that is selected

then use Array.sort() JavaScript function
then you can use Array.splice() function to remove a prticular part....

and finally use Array.unshift() fnction to add a value at the very beginning of the array.

Here is the documentation link

http://68.145.35.86/manuals/CoreReferenceJS15/array.html#1193137

or here

http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/

Hope this helps

Khalid