www.webdeveloper.com
Page 1 of 5 123 ... LastLast
Results 1 to 15 of 62

Thread: i need help...please!!

  1. #1
    Join Date
    Jun 2006
    Posts
    28

    i need help...please!!

    someone help me!!
    i'm taking a computer science class and i'm totally lost on my html/javascript project...
    These are the instructions:
    Create a web page with JavaScript functions that contains an input form for student data. It should accept: student last and first names; student identifier; major; midterm and final scores (out of 100 possible); class score (in percentages); final grade (the latter two calculated from the former two). Use JavaScript to allow for flexible input (no hard-coded data.) Finally, display a list of three students that the user has entered.

    mainly, i don't know how to submit all of the data to another file or page...
    or how to display a list of 3 people the user has entered...

    this is what i've managed to piece together so far:



    Code:
    <html>
    <head>
    <title>Student Information</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body background="532.jpg" style="background-attachment:fixed">
    <script language="JavaScript">
    function calcScore(mid, fin) {
         var score = 0;
         return score = mid * .4 + fin *.6;
    }
    function submitform()
    {
      document.GetScores.submit();
    }
    </script>
    
    
    <img src="pic4.jpg" width="111" height="100"> 
    <form name="GetScores" method="post" action=>
      <p><font color="#ffOOOO">First Name: 
        <input type="text" name="firstnameField">
      <p>Last Name: 
        <input type="text" name="lastnameField">  </p>
      <p>Student ID#: 
        <input type="text" name="IDField">
      <p>Birth Date: 
        <input type="text" name="birthdayField">  </p>
      <p>Major: 
        <input type="text" name="majorField"></p>
      <p>Midterm Score: 
        <input name="midterm" type="text" size="10">
      <p>Final Score: 
        <input name="final" type="text" size="10"> </p>
      <p>Course Score: % 
        <input name="finalScore" type="text" size="10">  
    </p>
    <p><input type=button name="calculateScore" 
          value="Calculate Final Score" 
    onClick = 'finalScore.value = 
          calcScore(midterm.value, final.value)'></p>
      <p>Class Grade:<br> 
        <input type="radio" name="grades" value="A"
    onClick="showMessage(this.value)" size=40>A = 90 - 100<br>
        <input type="radio" name="grades" value="B"
    onClick="showMessage(this.value)" size=40>B = 80 - 90<br>
        <input type="radio" name="grades" value="C"
    onClick="showMessage(this.value)" size=40>C = 70 - 80<br>
        <input type="radio" name="grades" value="D"
    onClick="showMessage(this.value)" size=40>D = 60 - 70<br>
        <input type="radio" name="grades" value="F"
    onClick="showMessage(this.value)" size=40>F = 0 - 59<br>
    <A href="javascript: submitform()"><font color="#ffOOOO">Submit</font></A>
    </form>
    </body>
    </html>

  2. #2
    Join Date
    Dec 2004
    Posts
    8,637
    Better that you get assistance from your teacher or from others in your class.

  3. #3
    Join Date
    Jun 2006
    Posts
    28
    its an online, uber-condensed course...
    and most of the students in our forum are more lost than i am...
    we're encouraged to use the internet as a resource and share info...
    i've checked a bunch of tutorial sites already...
    but its hard to find exactly what you need in those...
    thought someone on here might be able to help...

  4. #4
    Join Date
    Dec 2004
    Posts
    8,637
    Quote Originally Posted by dlrgold
    mainly, i don't know how to submit all of the data to another file or page...
    OK, to start... A form using the "POST" method can only be submitted to a server-side document (ASP, JSP, PHP, etc.) for processing. If you are going to be submitting to an HTML document, then you need to use the "GET" method of submission.

  5. #5
    Join Date
    Jun 2006
    Posts
    28
    thanks...that helped...
    now, how do i set up the 2nd page to recieve the data ?

  6. #6
    Join Date
    Dec 2004
    Posts
    8,637
    In the second page, you will find the data in this JavaScript property:

    top.location.search

  7. #7
    Join Date
    Jun 2006
    Posts
    11
    If, at the end, you have to display a list of several entries, you want be able to do it client side, so you need a server solution where you store the data.
    If you are using PHP the global variables $_POST and $_GET contain the data you submitted via a form or the get variables.
    if you have the input field <input type="text" name="test" value="" /> then you will be able to read the data with: $_POST['test'].
    Then you have to store them in a file, or a database.

  8. #8
    Join Date
    Jun 2006
    Posts
    28
    ok...now i'm a little confused...
    how would i go about storing the data on a server?
    and how exactly does top.location.search work?

  9. #9
    Join Date
    Dec 2004
    Posts
    8,637
    Quote Originally Posted by dlrgold
    ok...now i'm a little confused...
    Don't blame ya, when you get a second person throwing separate issues at you than the one you asked about. I'll just step outtta here at let the interloper take over.

    Cheers.

  10. #10
    Join Date
    Jun 2006
    Posts
    11
    Quote Originally Posted by phpnovice
    Don't blame ya, when you get a second person throwing separate issues at you than the one you asked about. I'll just step outtta here at let the interloper take over.
    lol, sorry, I didn't mean to offend anyone!

    I just ment: If you have several users, entering several sets of data, you have to store this somewhere, if you want to be able to process the data afterwards.

    If this is not the case, you don't have to store the data anywhere, and you can process it with javascript.

    top.location.search is used to read the get variables.

  11. #11
    Join Date
    Dec 2004
    Posts
    8,637
    Quote Originally Posted by enyo
    lol, sorry, I didn't mean to offend anyone!
    Seriously, no offense taken. I just know it is not easy to listen to two people giving advice at the same time about two different things at once. So... You apparently wanted to take over here and I have no problem giving it to you. There are plenty of other places to help.

  12. #12
    Join Date
    Jun 2006
    Posts
    28
    Quote Originally Posted by enyo
    I just ment: If you have several users, entering several sets of data, you have to store this somewhere, if you want to be able to process the data afterwards.
    ok...so should i open a domain at freeservers.com or something?
    if so, how would i go about scripting to get the data to the server?
    do i need to create some type of database or form?
    is this the ONLY way to list 3 users info?

  13. #13
    Join Date
    Dec 2004
    Posts
    8,637
    You said you were taking a class. Don't you think you should stick to what your current level of learning is? I think the class intended you to store the data in an array in the first page and then submit the content of that array to the second page for formatting and display. That is generally what JavaScript classes do.

    This is the sorta frustrating thing about when someone else jumps into the middle of a thread -- they may not have the same picture of things from the begining and, therefore, try to take the OP off in directions they probably shouldn't be going.

    But, I could be wrong. Hey, who ever said 26+ years of experience ever taught anyone anything.

  14. #14
    Join Date
    Jun 2006
    Posts
    28
    you're right...
    a server-side solution seems a little advanced for where we are in the class...
    i think the array idea sounds a bit more appropriate...
    so how would I store 3 users data in an array on the 1st page?

  15. #15
    Join Date
    Dec 2004
    Posts
    8,637
    You'd need a 2-dimensional aray for that. A table is an example of a 2-dimensional array (rows and columns are the dimensions). The following is an example of a JavaScript 2-dimensional array:

    var jsTable = new Array();
    jsTable.push( new Array("a", 1, 4) );
    jsTable.push( new Array("b", 2, 5) );
    jsTable.push( new Array("c", 3, 6) );

    This also demonstrates the technique you can use for updating this array with each entry made in your form. The form, of course, will accept only a single user's information at a time.

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