Why isn't this displaying? (javascript)

Pex

Banned
Aug 21, 2003
1,161
0
0
<html>
<head>
<title>North Pole Novelties</title>
<script language="JavaScript">
<!--- Hide from non-JavaScript browsers
function XmasDays(CurrentDay) {
var XYear=CurrentDay.getFullYear();
var XDay=new Date("December, 25, 2003");
XDay.setFullYear(XYear);
var DayCount=(XDay-CurrentDay)/(1000*60*60*24);
DayCount=Math.round(DayCount);
return DayCount;
}
function MonthTxt (MonthNumber) {
var Month=new Array();
Month[1]="January";
Month[2]="February";
Month[3]="March";
Month[4]="April";
Month[5]="May";
Month[6]="June";
Month[7]="July";
Month[8]="August";
Month[9]="September";
Month[10]="October";
Month[11]="November";
Month[12]="December";
return Month[MonthNumber];
}
function WeekDayTxt(WeekDayNumber) {
var WeekDay=new Array();
WeekDay[1]="Sunday";
WeekDay[2]="Monday";
WeekDay[3]="Tuesday";
WeekDay[4]="Wednesday";
WeekDay[5]="Thursday";
WeekDay[6]="Friday";
WeekDay[7]="Saturday";
return WeekDay[WeekDayNumber];
}
// Stop hiding -->
</script>
<style>
body {background-image: url(wrap.jpg)}
a {color: green; text-decoration:none; font-size:x-small;
font-weight:bold; font-family: Arial, Helvetica, sans-serif}
a:hover {color:red}
p b {color:red}
h3 {font-family: Arial, Helvetica, sans-serif; color:green}
</style>
</head>

<center><table width="600" cellpadding="5" cellspacing="0" border="1" bgcolor="white">
<tr>

<!--- Company Hyperlinks --->
<td valign="top" width="100" rowspan="4" bgcolor="black">
<h5 style="color:white; font-family: Arial, Helvetica, sans-serif">
Why don't you visit our:</h5>
<a href="const.htm">Home Page</a>

<a href="const.htm">Angels</a>

<a href="const.htm">Cards</a>

<a href="const.htm">Collectibles</a>

<a href="const.htm">Creches</a></br>
<a href="const.htm">Garland</a>

<a href="const.htm">Gift Wraps</a>

<a href="const.htm">Lights</a>

<a href="const.htm">Nutcrackers</a>

<a href="const.htm">Ornaments</a>

<a href="const.htm">Santas</a>

<a href="const.htm">Trains</a>

<a href="const.htm">Trees</a>

<a href="const.htm">Villages</a>

<a href="const.htm">Wreaths</a>
</td>

<!--- Company Logo --->
<td valign="top" width="500" align="center">
<img src="logo.jpg">
</td>
</tr>
<tr>

<!--- Days until Christmas --->
<td valign="top" align="center" bgcolor="gold">
<span style="font-size:small; font-weight:bold">
<script language="JavaScript">
<!--- Hide from non-JavaScript browsers
var Now=new Date();
var ThisDay=Now.getDate();
var ThisWeekDay=Now.getDay();
var ThisMonth=Now.getMonth()+1;
var ThisYear=Now.getFullYear();
var DaysLeft=XmasDays(Now);
var MonthName=MonthTxt(ThisMonth);
var ThisWeekDay=Now +1;
var WeekDayTxt(WeekDayName);

document.write("Today is "+ThisWeekDay+","+MonthName+" "+ThisDay+"
");
if (DaysLeft > 0) {
document.write("Only "+DaysLeft+" days until Christmas");
} else{
if (DaysLeft == 1)
document.write("Last day for Christmas shopping");
} else{
document.write("Happy Holidays from North Pole Novelties");
}

// Stop hiding --->
</script>
</span>
</td>
</tr>
<tr>

<!--- Articles about the company --->
<td>
<table border="0" cellspacing="4" cellpadding="4" width="500">
<tr>
<!--- Welcome message --->
<td valign="top" width="250">
<h3>Welcome!</h3>
<p><img src="bells.jpg" align="left">Welcome to <b>North
Pole Novelties</b>. Consider us your complete holiday
store. Whether you're a collector or simply looking for a beautiful
piece to treasure for years, you'll find it at NPN. Please click on
one of the many links to explore all we have to offer.</p>

<!--- Latest news --->
<h3>News Flash!</h3>
<p>North Pole Novelties is proud to announce a new line of
<b>Lasseter Old Towne Village collectible houses</b>.
Start building your collection of these wonderful miniature
porcelain houses and shops. </p>
<p>Each model has accessories to enhance the collection. Be sure to
order extra trees, fences, street lights and signs to bring activity
and a festive atmosphere to your miniature town.</p>
</td>

<!--- Information about the company --->
<td valign="top" width="250">
<h3>Who Are We?</h3>
<p><img src="watkins.jpg" align="right">Located in Seton Grove,
Minnesota, North Pole Novelties is one of the oldest and largest
holiday stores in the country. The store was founded in 1968 by
<b>David Watkins</b> (shown here). Today,
David, his family, and over 300 employees manage the daily operation
of making the holiday season last all year.</p>
<p>The store itself is the size of two football fields and attracts
visitors from around the world. If you can't pay us a visit, order our
catalogue. We will deliver to any spot in the United States and
overseas. In a rush? We can deliver your order overnight! We also
gift wrap.</p>
</td>
</tr>
</table>
</td>
</tr>
<tr>

<!--- Contact Information --->
<td colspan="1" align="center">
<span style="font-size:x-small; color:green; font-weight:bold;font-family:sans-serif">
North Pole Novelties

25 Oakdale Avenue

Seton Grove, MN     53112

Telephone: (404) 555-1225
</span>
</td>
</tr>
</table>
</center>
<body>
</html>



why isnt the Current date and time till xmas displaying?
 

replicator

Senior member
Oct 7, 2003
431
0
0
document.write("Today is "+ThisWeekDay+","+MonthName+" "+ThisDay+" ");
if (DaysLeft > 0) {
document.write("Only "+DaysLeft+" days until Christmas");
} else if (DaysLeft == 1) {
document.write("Last day for Christmas shopping");
} else{
document.write("Happy Holidays from North Pole Novelties");
}

your if statement was wrong