Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

displaying the highest total entered in using javascript?

  • 10-10-2007 05:16PM
    #1
    Registered Users, Registered Users 2 Posts: 6,537 ✭✭✭


    hey can someone tell me how you display the highest total number entered in javascript?

    the question is youve to enter your salary for each month and then to display the month which has the highest salary.

    Any ideas? thanks!


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Put them into an array and bubble sort them.


  • Users Awaiting Email Confirmation Posts: 351 ✭✭ron_darrell


    Hi OP there is a function of the array object in javascript called sort. Go to http://www.w3schools.com/js/ and look it up. I must point out however that from the way you describe it it may not be a javascript problem. You're selecting a month and a wage? Is the data hard-coded to the page or are you POST/GET the form to a script for processing? In that case the sort will have to be performed in the script server-side and the result sent back to the client page. The sort then will depend on the server side scripting language (for ASP it's generally VBScript though ASP can be written in javascript, for PHP it PHP, for java servlets it would be java etc.)

    Moderator, while he could write a bubble sort function it might be easier just to use what's already there. no point re-inventing the wheel :D


Advertisement