Odoo Help

0

Set timer in website module

By
Umashankar Subramani
on 5/5/15, 5:32 AM 607 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);

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

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