javascript Change variable gradually over five seconds

DemonElite118

New Member
I'm a beginner when it comes to JavaScript. I'm trying to change the value of a progress bar from 100 to 0 in five seconds and I can't get it to work right. I tried this tutorial but there was no way to control the time. I have a JSFiddle to show what I have. I'd really appreciate any help.My Javascriptvar correct = "a1";function onload(){var question1 = "Who was the first president?";var answers = { "a1":"George Washington", "a2":"John Adams", "a3":"Bill Clinton", "a4":"Richard Nixon"}; document.getElementById("qstn").innerHTML=question1;document.getElementById("a1").innerHTML=answers.a1; document.getElementById("a2").innerHTML=answers.a2; document.getElementById("a3").innerHTML=answers.a3; document.getElementById("a4").innerHTML=answers.a4;var bar = document.getElementById("bar").value;}with my HTML being<body onload="onload()"><p id="qstn"></p><button class="btn" onclick="checker()"><span id="a1"></span></button><button class="btn" onclick="checker()"><span id="a2"></span></button><button class="btn" onclick="checker()"><span id="a3"></span></button><button class="btn" onclick="checker()"><span id="a4"></span></button><progress value="http://stackoverflow.com/questions/15687152/100" max="100" id="bar"></progress></body>Again, any help or comments would be greatly appreciated.
 
Back
Top