Question #238108

3.4 When the student is ready to check his results, he will select the result button. His studentID, firstname, and all modules results will show in the results table.


Expert's answer

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Q238108</title>
</head>
<body>
    <fieldset>
        <input id="studentID" type="text" placeholder="Student ID"><br/><br/>
        <input type="submit" value="Result" onclick="onSubmit()"><br/>
    </fieldset>
    <section></section>
    <script>
      students = {
        1: {name: "Body", surname: "Locke", age: 10},
        2: {name: "Amily", surname: "Bob", age: 9},
        3: {name: "Luccy", surname: "Success", age: 14}
      }
      function onSubmit() {
        let id = document.querySelector('#studentID').value;
        let tag = document.querySelector('section');
        tag.innerHTML =
          "<ul>" +
            "<li> Name: " + students[id]?.name + "</li>" + "<br/>" +
            "<li> Surname: " + students[id]?.surname + "</li>" + "<br/>" +
            "<li> Age: " + students[id]?.age + "</li>" +
          "</ul>";
      }
    </script>
</body>
</html>

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS