View Single Post
01-02-2010, 07:38 AM
#2
hjalmar is offline hjalmar
Status: Senior Member
Join date: Nov 2004
Location: Sweden
Expertise:
Software:
 
Posts: 857
iTrader: 11 / 100%
 

hjalmar is an unknown quantity at this point

  Old

HTML Code:
	<script type="text/javascript">
	<!--Hide from old browsers
	var today = new Date();
	var dayofweek = today.toLocaleString();
	var dayLocate = dayofweek.indexOf(" ");
	var weekDay = dayofweek.substring(0, dayLocate);
	var newDay = dayofweek.substring(dayLocate);
	var dateLocate = newDay.indexOf(" ");
	var monthDate = newDay.substring(0, dateLocate+1);
	var yearLocate = dayofweek.indexOf("2010");
	var year = dayofweek.substr(yearLocate, 4);

	var springDate = new Date("March 21, 2010");
	var daysToGo = springDate.getTime()-today.getTime();
	var daysToSpring = Math.ceil(daysToGo/(1000*60*60*24));

	document.write("<p style=\"margin-left:10%; font-family:Arial, sans-serif; font-weight:bold; font-size:14\">Today is "+weekDay+" "+monthDate+" "+year+", that leaves only "+ daysToSpring +" days until the start of spring.")
	document.write("<br />Spring is the time to prepare your landscape for new growth of flowers and lawns. ")
	document.write("<br />Call us now at (221) 555-9100 for a free consultation and free eestimate.</p>")

	//-->
	</script>
You need to escape " and you had a typo... monthDay? monthDate?

Reply With Quote