www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] How to change the number in the Array[] displayed?

Hybrid View

  1. #1
    Join Date
    Apr 2014
    Posts
    44

    resolved [RESOLVED] How to change the number in the Array[] displayed?

    Another question for this wonderful forum. Any help on the problem below would be greatly appreciated. Thanks!

    I'm putting together a simple script that prompts the user for Student Names and then asks their marks. Here's the code so far:

    PHP Code:
    var sQuantity parseInt(prompt("Let's begin compiling our student database. How many students would you like to enter?""Number of Students"));

    var 
    sList = new Array();
    var 
    sMarks = new Array();

    for (var 
    count 0count sQuantitycount++) {
        
    sList.push(prompt("Please enter the Student's Name""Students Name"));
    }
    for (var 
    count 0count <sQuantitycount++) {
        
    sMarks.push(prompt("Please enter " sList[0] + "'s average grade for this course.""Enter Average Grade"));
    }

    document.write(sList[0] + " " sList[1]+ " " " " sList[2]+ " " sList[3])
    document.write(sMarks[0] + " " sMarks[1]+ " " " " sMarks[2]+ " " sMarks[3]) 
    In the second "for" loop, it uses the sList[0] to display the student's name. How do I made the [0] go up after each loop so that the proper student name appears in each prompt?

  2. #2
    Join Date
    Apr 2014
    Posts
    44
    I figured it out! Thanks to anyone that took a look, but I've got it now.

Thread Information

Users Browsing this Thread

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

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