How do i add a countdown timer function for examination on MVC framework using vs community.

sloppybeef 1 Reputation point
2021-12-21T05:48:12.42+00:00

I am currently working on a project that features a question bank. The admins, can create quizzes and compiling questions from the question bank to assign to a specific quiz. my system also has a user log in whereby they will be able to log in and attempt the quizzes set by the admin. Currently, in the user role I want to be able to add a timer function to my quiz attempt view page for the users. When the timer runs out it will automatically execute the submit button. How do i go about doing it? Im thinking the timer function would fall under scriptsection in the attempt quiz view page? need help. TIA.

Developer technologies ASP.NET ASP.NET Core
{count} votes

1 answer

Sort by: Most helpful
  1. Ken Tucker 5,861 Reputation points
    2021-12-21T11:46:25.103+00:00

    You would have to use Javascript for this. Here is an example count down

    https://www.w3schools.com/howto/howto_js_countdown.asp

    in this function in the w3school example

      if (distance < 0) {
        clearInterval(x);
        document.getElementById("demo").innerHTML = "EXPIRED";
      }
    

    You can call the function that submits the quiz

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.