TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nel
NA
716
1.1m
Indicator for how much time is left
Sep 24 2014 7:25 AM
Hello,
I have a web page with a displayed google map and every several seconds the values are updated automatically on the map. Can anybody tell me please how to place an indicator that will show how much time is left for the next update?
For the timer I have this in the java script
var tim=<%= Session["21"] %>*1000;
setInterval(function(){ initialize();}, tim);
Thanks
I tried like this, but doesn't work
function startCountdown(timeLeft) {
var interval = setInterval( countdown, tim*1000 );
update();
function countdown() {
if ( --timeLeft > 0 ) {
update();
} else {
clearInterval( interval );
update();
completed();
}
}
function update() {
hours = Math.floor( timeLeft / 3600 );
minutes = Math.floor( ( timeLeft % 3600 ) / 60 );
seconds = timeLeft % 60;
setInterval(function(){ initialize();}, tim*1000);
document.getElementById('time-left').innerHTML = '' + hours + ':' + minutes + ':' + seconds;
}
function completed() {
alert('Time Up!');
//Your Logic here
//setInterval(function(){ initialize();}, tim*1000);
}
}
...
..
<body onload="initialize()"; "startCountdown(20)"; style="padding: 1em">
...
...
Time Left <span id="time-left"></span>
Can anybody help me please?
Reply
Answers (
2
)
my problem with scrollHeight
SEO related suggestion