Order variables by their value > Need help here!

Discussion in 'JavaScript' started by bayernschweiz, Jun 2, 2007.

  1. #1
    hi all this is my first message on this forum... great forum here you guys seem to be real experts ive been told to come here for my javascript question hope u can help me with this...

    ok to the code itself... its a page that calculates how many 'awards' you can get in an online game

    i have done all the parts that calculate how many days left to get the awards and for all of them but one thing remains and that is ordering them by how many times you should do that thing to get the next award.

    for example if u click on 'Calculate' button by default at top u will see "1000 more fts to get Sneak Award! " and then under that is "500 more computer points to get Ub3rn00b techie Award! "

    or by numbers only its ordered like this at the moment:

    1000
    500
    1000
    250
    300
    200
    50
    100
    250
    5

    what i want is ordering them by the number at the beginning, this is the right format for default values :

    5
    50
    100
    200
    250
    250
    300
    500
    1000
    1000


    Tool.htm file is included in the zip file, since the original size was like more than 50 KB.


    hope you understood my question, any help would be appreciated.
    Thanks in advance
     

    Attached Files:

    bayernschweiz, Jun 2, 2007 IP
  2. CygnetGames

    CygnetGames Peon

    Messages:
    43
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Javascript has sorting functions built in, check ont these tutorials:
    _http://www.topxml.com/javascript/javascript_array_functions.asp#sort
    _http://www.merlyn.demon.co.uk/js-order.htm#Sort
    _http://www.w3schools.com/jsref/jsref_sort.asp
    _http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256C8D00514FA4
     
    CygnetGames, Jun 2, 2007 IP
    bayernschweiz likes this.
  3. bayernschweiz

    bayernschweiz Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks man, that's what i wanted.

    right now im working on how to order numeric variables as said in the tutorial at http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256C8D00514FA4

    hope can finally make it work soon, Thanks again! :)
     
    bayernschweiz, Jun 3, 2007 IP