Jump to content

Count Up Script ?


CaTaLinU

Recommended Posts

You would need javascript for that.

 

<script type="text/javascript">
function timeMsg()
{
    var t=setTimeout("alertMsg()",3000); // 3000 microsecond = 3 seconds.
}
function alertMsg()
{
    alert("Hello"); // after 3 seconds, this alert dialog will be displayed.  You could get rid of this, and have the script do whatever you need it to do.
}
</script>

Link to comment
Share on other sites

<html>
<head>
<script type="text/javascript">
var c = 0;
var t;
var timer_is_on = 0;

function timed_count() {
document.getElementById('counter').innerHTML = c;
c = c+1;
t = setTimeout('timed_count()',1000);
}

function do_timer() {
if(!timer_is_on) {
  timer_is_on = 1;
  timed_count();
}
}
window.onload = do_timer;
</script>
</head>
<body>
<div id="counter">0</div>
</body>
</html>

Link to comment
Share on other sites

Better to use an interval in this case:

 

var counter;
var count = 1;

function do_count() {
    document.getElementById('counter').innerHTML = count++;
}

window.onload = function() {
    counter = setInterval('do_count()', 1000);
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.