You need to sign in to do that
Don't have an account?
jaanvivek
How to Show Custom timer using Java script on VF page
I need to show custom timer on a VF page.
I have 6 questions to be answered on VF page so i want to show timer in form "0:00".
I want to give only 10 minutes for a page after 10 minutesthe timer should stop and it should be in "0:10" form
I have tried some java script but not successed.
could any one suggest something.
Thanks
JaanVivek
I have tried below one.
It's showing timer in "0.10" format.
Thanks,
JaanVivek
<output name="x" id="txt"/>
<script>
var num=0.100;
var c=num.toFixed(2);
var t;
var myVar;
var myVarOne;
function myFunction()
{
t=setInterval(function(){myTimer()},1000);
}
function myTimer()
{
document.getElementById('txt').value=c;
var z= 0.010;
var m=z.toFixed(2);
c=(c-m).toFixed(2);
if(c==0.05)
{
myVar=setTimeout(function(){alert("Only 5 minutes are left")},1000);
}
else if(c==-0.01)
{
clearInterval(t);
myVarOne=setTimeout(function(){alert("Sorry your time is over")},1000);
}
}
</script>
<body onload="myFunction()"></body>