...

View Full Version : adding line to script



Wolvie
03-05-2009, 09:43 AM
Hi,

I have this script for a countdown clock and like to add a line. I like to have a line that says merry christmas on christmas day. Can anyone help me?

Astrid

<script language="javascript">
today = new Date();
BigDay = new Date("December 25, 2009")
msPerDay = 24 * 60 * 60 * 1000 ;
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
document.write( " "+daysLeft+" days until Christmas!");
</script>

Philip M
03-05-2009, 10:36 AM
Here you are:-


<script type = "text/javascript">
today = new Date();
BigDay = new Date("December 25, 2009")
msPerDay = 24 * 60 * 60 * 1000 ;
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
if (daysLeft > 0) {
document.write(daysLeft + " days until Christmas!");
}
if (daysLeft == 0) {
document.write ("Merry Christmas!"); // or "Season\'s Greetings" in these politically correct times.
}
// after 25th December nothing will be displayed.

</script> Note that <script language="javascript"> is deprecated and obsolete. Use <script type = "text/javascript"> instead.



Quizmaster: If something in dispute is divided equally, it is referred to as splitting the ... what?
Contestant: Atom.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum