Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Set timer in website module

By
Umashankar Subramani
on 5/5/15, 5:32 AM 473 views

Hi, 

   I am working on a custom module, in which i have a doubt, i am trying to develop an online exam module, i need to display  timer in the respected page and after the completion of the time duration that particular page need to be closed. for eg. duration is 90min, the initial timer value is 90 and before completion it has to give some warning. How can i do this plz anyone give me some suggestion,,,,,,,,,,,,,,,

3

Hi,

   I got the desired result , here is the javascript code i have used to display the timer in answer sheet and after completion of the timer it will automatically close the current page.

timer.js


var seconds = 5400; #Total duration of the exam 90min

function secondPassed() {

var minutes = Math.round((seconds - 30)/60);

var remainingSeconds = seconds % 60;

if (remainingSeconds < 10) {

remainingSeconds = "0" + remainingSeconds;

}

document.getElementById('countdown').innerHTML = "Total Duration"+" " + minutes + ":" + remainingSeconds;

if (seconds == 0) {

clearInterval(countdownTimer);

document.getElementById('countdown').innerHTML = "Times Up Leave the Exam hall";

window.location="http://localhost:8069/page/exam/result";

} else {

seconds--;

}

}

var countdownTimer = setInterval('secondPassed()', 1000);

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/5/15, 5:32 AM
Seen: 473 times
Last updated: 5/6/15, 8:49 AM