Stopwatch code for website

Wizet

New Member
Messages
644
Reaction score
0
Points
0
I am in need for a stopwatch code for my website. I would like the stopwatch code to placed in the top left corner of the website. Here is the link: mfhome.x10hosting.com/index2.html.

Here is what the the stopwatch needs:
- It must be editable
- Cannot have a box over it and must look like it is in normal text.
- Updates without refreshing.

And I guess that's it!
 

EliteACE

New Member
Messages
9
Reaction score
0
Points
0
google javascript stop watch. there are plenty of free scripts available. And its up to you to position it where you want ;) good luck
 

Wizet

New Member
Messages
644
Reaction score
0
Points
0
Here is what the the stopwatch needs:
- It must be editable
- Cannot have a box over it and must look like it is in normal text.
- Updates without refreshing.

Does this make you think twice?
 

nightscream

New Member
Messages
948
Reaction score
0
Points
0
there really are a lot on the internet, maybe it's better to put this in the marketplace. It's not that hard to make ;)
 

Wizet

New Member
Messages
644
Reaction score
0
Points
0
*Smile* That's why I posted a thread. =) If you understand how I'm talking ahem typing right now.
 

cursedpsp

New Member
Messages
237
Reaction score
0
Points
0
cant you just put php code and stick it in an iframe? no borders?

then you can construct some php code (im not bothered to write) with an refresh and because its in an iframe the rest of your content isnt interrupted.
 
Last edited:

nexhunter

New Member
Messages
239
Reaction score
1
Points
0
Found a Countdown that can work for both all you need to do is edit the target time,
Link to coder - http://www.hashemian.com/tools/javascript-countdown.htm
Example in usage for me http://xstudio.us.to/test/
Code:
Enter into editor
/*
Author: Robert Hashemian
http://www.hashemian.com/

You can use this code in any manner so long as the author's
name, Web address and this disclaimer is kept intact.
********************************************************
*/
function calcage(secs, num1, num2) {
  s = ((Math.floor(secs/num1))%num2).toString();
  if (LeadingZero && s.length < 2)
    s = "0" + s;
  return "<b>" + s + "</b>";
}

function CountBack(secs) {
  if (secs < 0) {
    document.getElementById("cntdwn").innerHTML = FinishMessage;
    return;
  }
  DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000));
  DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60));

  document.getElementById("cntdwn").innerHTML = DisplayStr;
  if (CountActive)
    setTimeout("CountBack(" + (secs+CountStepper) + ")", SetTimeOutPeriod);
}

function putspan(backcolor, forecolor) {
 document.write("<span id='cntdwn' style='background-color:" + backcolor + 
                "; color:" + forecolor + "'></span>");
}

if (typeof(BackColor)=="undefined")
  BackColor = "none";
if (typeof(ForeColor)=="undefined")
  ForeColor= "black";
if (typeof(TargetDate)=="undefined")
  TargetDate = "12/31/2020 5:00 AM";
if (typeof(DisplayFormat)=="undefined")
  DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
if (typeof(CountActive)=="undefined")
  CountActive = true;
if (typeof(FinishMessage)=="undefined")
  FinishMessage = "";
if (typeof(CountStepper)!="number")
  CountStepper = -1;
if (typeof(LeadingZero)=="undefined")
  LeadingZero = true;


CountStepper = Math.ceil(CountStepper);
if (CountStepper == 0)
  CountActive = false;
var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990;
putspan(BackColor, ForeColor);
var dthen = new Date(TargetDate);
var dnow = new Date();
if(CountStepper>0)
  ddiff = new Date(dnow-dthen);
else
  ddiff = new Date(dthen-dnow);
gsecs = Math.floor(ddiff.valueOf()/1000);
CountBack(gsecs);

Save file as countdown.js

Open webpage and insert into wherever your countdown is,

		<script language="JavaScript">
TargetDate = "12/31/2020 5:00 AM"; \\ Edit this time and date m/d/y format
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
FinishMessage = "It is finally here!"; \\ Edit this message
</script>
<script language="JavaScript" src="path/to/countdown.js"></script>
 
Last edited:

Wizet

New Member
Messages
644
Reaction score
0
Points
0
Found a Countdown that can work for both all you need to do is edit the target time,
Link to coder - http://www.hashemian.com/tools/javascript-countdown.htm
Example in usage for me http://xstudio.us.to/test/
Code:
Enter into editor
/*
Author: Robert Hashemian
http://www.hashemian.com/

You can use this code in any manner so long as the author's
name, Web address and this disclaimer is kept intact.
********************************************************
*/
function calcage(secs, num1, num2) {
  s = ((Math.floor(secs/num1))%num2).toString();
  if (LeadingZero && s.length < 2)
    s = "0" + s;
  return "<b>" + s + "</b>";
}

function CountBack(secs) {
  if (secs < 0) {
    document.getElementById("cntdwn").innerHTML = FinishMessage;
    return;
  }
  DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000));
  DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60));

  document.getElementById("cntdwn").innerHTML = DisplayStr;
  if (CountActive)
    setTimeout("CountBack(" + (secs+CountStepper) + ")", SetTimeOutPeriod);
}

function putspan(backcolor, forecolor) {
 document.write("<span id='cntdwn' style='background-color:" + backcolor + 
                "; color:" + forecolor + "'></span>");
}

if (typeof(BackColor)=="undefined")
  BackColor = "none";
if (typeof(ForeColor)=="undefined")
  ForeColor= "black";
if (typeof(TargetDate)=="undefined")
  TargetDate = "12/31/2020 5:00 AM";
if (typeof(DisplayFormat)=="undefined")
  DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
if (typeof(CountActive)=="undefined")
  CountActive = true;
if (typeof(FinishMessage)=="undefined")
  FinishMessage = "";
if (typeof(CountStepper)!="number")
  CountStepper = -1;
if (typeof(LeadingZero)=="undefined")
  LeadingZero = true;


CountStepper = Math.ceil(CountStepper);
if (CountStepper == 0)
  CountActive = false;
var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990;
putspan(BackColor, ForeColor);
var dthen = new Date(TargetDate);
var dnow = new Date();
if(CountStepper>0)
  ddiff = new Date(dnow-dthen);
else
  ddiff = new Date(dthen-dnow);
gsecs = Math.floor(ddiff.valueOf()/1000);
CountBack(gsecs);

Save file as countdown.js

Open webpage and insert into wherever your countdown is,

        <script language="JavaScript">
TargetDate = "12/31/2020 5:00 AM"; \\ Edit this time and date m/d/y format
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
FinishMessage = "It is finally here!"; \\ Edit this message
</script>
<script language="JavaScript" src="path/to/countdown.js"></script>

Link doesn't work. =Broken Link.

I have found this script to be good for count up/downs:
http://andrewu.co.uk/clj/countdown/
But setting it up as a stopwatch can be a bit hard...

There are requirements, but nice try though I'll give you that.
 
Last edited:

nexhunter

New Member
Messages
239
Reaction score
1
Points
0
mmm that wierd the link works the example usage on my site doesn't work since the server's are going up and done most of the time for the updates
 
Top