www.webdeveloper.com
Results 1 to 4 of 4

Thread: Urgent help with javascript!!!!

  1. #1
    Join Date
    May 2013
    Posts
    2

    Exclamation Urgent help with javascript!!!!

    I am doing website for searching careers using a html form. I am only allowed to use HTML and JavaScript to do this task. I managed to complete most of it however I had problems comparing the salary of the jobs and the salary the user inputs.


    I have stored jobs in arrays and they are accessed using the catLength and catList. I only want the application to display jobs that are higher than the minimum salary selected by the user.

    function miniSalary()
    {
    var myForm=document.getElementById("jobForm")
    var catList=myForm.cat;
    var catLength = catList.length;
    var minSalary = myForm.salary.selected;
    var valSal = minSalary.value;
    var maxiSalary = myForm.maxSalary.value;


    if (catLength )
    {
    for ( i=0;i<catList.length;i++)
    {
    if (catList[i].checked)
    {

    for (var j=0;j<jobs.length;j++)
    {

    if (catList[i].value == jobs[j].category)

    {

    if (valSal <= jobs[j].minimumSalary)
    {
    console.log("Working")
    console.log(jobs[j].ujob + " Minimum salarry: " + jobs[j].minimumSalary)
    }

    }


    }
    }
    }



    }
    }

  2. #2
    Join Date
    Jul 2012
    Posts
    55
    Try reworking this without doing infinite condition statements, you can do this without them
    and maybe use one for loop.

  3. #3
    Join Date
    May 2013
    Posts
    2
    Please can you help me get started. I am only a beginner at JavaScript so I don't really know where to start. Thank you

  4. #4
    Join Date
    Jul 2012
    Posts
    55
    You can start by learning javascript

    here is info about arrays: http://www.w3schools.com/js/js_obj_array.asp

    here is info on how condition statements actually work: http://www.w3schools.com/js/js_if_else.asp

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles