Page 1 of 1

Auto Refresh

Posted: Mon Jan 11, 2010 4:20 am
by Jay87
I want my calllist.php page to refresh every 120 seconds and to have a countdown on the page until the page will refresh...

Any ideas on how i can do this??

Re: Auto Refresh

Posted: Mon Jan 11, 2010 4:27 am
by Jay87
I got the page to auto refresh using:

<tr><meta http-equiv="refresh" content="120;url=calllist.php"></tr>


no idea how to get a counter though (from 120 secs)...

Help plz

Re: Auto Refresh

Posted: Fri Jan 15, 2010 2:04 pm
by klevis miho
Try to find a javascript counter, i'm sure it isnd hard to find one

Re: Auto Refresh

Posted: Fri Jan 15, 2010 3:42 pm
by Jonah Bron

Code: Select all

 
<span id="countdown_box">140</span>
<script type="text/javascript">
function decrementNumber(){
    var t = document.getElementById('countdown_box');
    var r = parseInt(t.innerHTML);
    r = r - 1;
    t.innerHTML = r;
}
x = setInterval(function (){ decrementNumber(); }, 1000);
</script>
 
I think the <span> tag (or div, whatever) must come before the javascript.

Re: Auto Refresh

Posted: Mon Jan 18, 2010 8:42 am
by Jay87
That code worked a treat...!

any idea how i can add the text: This page will auto-refresh in: [countdown] seconds

?

Re: Auto Refresh

Posted: Mon Jan 18, 2010 8:53 am
by Grizzzzzzzzzz

Code: Select all

This page will auto-refresh in: <span id="countdown_box">140</span> seconds
 <script type="text/javascript">
function decrementNumber(){
     var t = document.getElementById('countdown_box');
     var r = parseInt(t.innerHTML);
     r = r - 1;
     t.innerHTML = r;
 }
 x = setInterval(function (){ decrementNumber(); }, 1000);
 </script>
 
?