Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

displaying the highest total entered in using javascript?

Options
  • 10-10-2007 5:16pm
    #1
    Registered Users Posts: 6,521 ✭✭✭


    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 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