yglobal
asked on
countdown without popup alert box
I have pages that members look at for 5 seconds. If they do not look at them for that time and click to see the next one, they do not gain a point for viewing it.
I have a javascript that works fine for the countdown of the viewing time, but would like to remove the alert popup box that showws after 5 seconds, and just make it work silently behind the scenes as they already have one button to click to view the next and dont want to make them also click the alert box too. Can this be done?
<div id="iddate"></div>
<script type="text/javascript">
var clockSet = 0;
var viewTimeEnough = false;
function displayTime(delay){
nowDate = new Date();
if (clockSet != 1) {
delayDate = new Date(nowDate.getTime() + delay*1000);
clockSet = 1;
}
document.getElementById('i ddate').in nerHTML = Math.round((delayDate - nowDate)/1000) + ' Seconds';
if (nowDate >= delayDate ) {
// alert ('stop');
viewTimeEnough = true;
alert(viewTimeEnough);
return;
}
setTimeout("displayTime(); ",1000);
}
displayTime(5);
</script>
I have a javascript that works fine for the countdown of the viewing time, but would like to remove the alert popup box that showws after 5 seconds, and just make it work silently behind the scenes as they already have one button to click to view the next and dont want to make them also click the alert box too. Can this be done?
<div id="iddate"></div>
<script type="text/javascript">
var clockSet = 0;
var viewTimeEnough = false;
function displayTime(delay){
nowDate = new Date();
if (clockSet != 1) {
delayDate = new Date(nowDate.getTime() + delay*1000);
clockSet = 1;
}
document.getElementById('i
if (nowDate >= delayDate ) {
// alert ('stop');
viewTimeEnough = true;
alert(viewTimeEnough);
return;
}
setTimeout("displayTime();
}
displayTime(5);
</script>
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.