GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Anyone point me towards the code that does a 'count up'? (https://gfy.com/showthread.php?t=1153426)

CurrentlySober 11-01-2014 10:42 AM

Anyone point me towards the code that does a 'count up'?
 
You know how certain websites display a countdown to a future event? Months / Days / Hours / Mins / Seconds etc?

I wanna do the opposite. Count up ! So it would still be the same as the above example, but it would get bigger, rather than smaller...

Just simple and non flashy. Don't need bells n whistles or a fancy graphical display...
Its just for personal use, but as such (ie non commercial use) I'd like it to be free?

Thanks :thumbsup

SpotOnTechSupport 11-01-2014 10:52 AM

Did a bit of searching and came up with this:

Code:

<script type="text/javascript">



function secondize(n)
{
if (n!=0)
  {
  n= n / 1000;
  }
return n;
}



var timer = {
    init: function() {
        this.startTime = (new Date()).getTime();
        return this;
    },
    stop: function() {
        // returns time difference (in seconds: getSeconds()) between start time and time that this function was called

                var difference = new Date();
                var timeUsed=secondize(difference.setTime((new Date().getTime()) - this.startTime));


                return timeUsed;
    }
};
var count = timer.init();

</script>


CurrentlySober 11-01-2014 12:40 PM

Quote:

Originally Posted by SpotOnTechSupport (Post 20274589)
Did a bit of searching and came up with this:

Code:

<script type="text/javascript">



function secondize(n)
{
if (n!=0)
  {
  n= n / 1000;
  }
return n;
}



var timer = {
    init: function() {
        this.startTime = (new Date()).getTime();
        return this;
    },
    stop: function() {
        // returns time difference (in seconds: getSeconds()) between start time and time that this function was called

                var difference = new Date();
                var timeUsed=secondize(difference.setTime((new Date().getTime()) - this.startTime));


                return timeUsed;
    }
};
var count = timer.init();

</script>


Thanks mate. Whats daft, is I was trying to get a particular code to behave itself, and it wouldnt...

So I made this thread. Since then I have got it working!

But thanks anyway - All is good :)


All times are GMT -7. The time now is 10:09 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123