Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Basic Countdown Javascript Code
PostPosted: July 5th, 2007, 12:49 pm 
Runite Member
Offline

Joined: August 4th, 2005, 5:18 pm
Posts: 345
Location: BLVCKLVND us
RS Status: P2P
I was doing some searching for different codes and I found out how to do this little basic one:

Code:
<html>
<head>
<title>JavaScript Countdown timer test</title>

<script language="javascript" type="text/javascript">

today  = new Date();
todayEpoch  = today.getTime();

target = new Date("DD MM, YYYY");
targetEpoch = target.getTime();

daysLeft = Math.floor(((targetEpoch - todayEpoch) / (60*60*24)) / 1000);
</script>

</head>
<body>

<h1>SOMETHING HERE HAPPENS in

<script>document.write(daysLeft);</script>

days. EXTRA/OPTIONAL TEXT HERE
</h1>

</body>


And heres my result:

Code:
<html>
<head>
<title>JavaScript Countdown timer test</title>

<script language="javascript" type="text/javascript">

today  = new Date();
todayEpoch  = today.getTime();

target = new Date("27 July, 2007");
targetEpoch = target.getTime();

daysLeft = Math.floor(((targetEpoch - todayEpoch) / (60*60*24)) / 1000);
</script>

</head>
<body>

<h1>The Simpsons Movie premieres WORLDWIDE in

<script>document.write(daysLeft);</script>

days. Freeze yourself if you want!
</h1>

</body>

_________________
Accepting any in-game donations! :D


Top
 Profile  
 
 Post subject: Register and login to get these in-post ads to disappear
PostPosted: July 5th, 2007, 12:49 pm 
Runite Member

Joined: September 9th, 2004, 1:47am
Posts: 9047
Location: In your web browserz


Top
  
 
Display posts from previous:  Sort by  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to: