Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1348 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Javascript :

Help with JavaScript

Thread title: Help with JavaScript
     
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
01-02-2010, 05:47 AM
#1
AndrewIGO is offline AndrewIGO
Status: Junior Member
Join date: Feb 2006
Location:
Expertise:
Software:
 
Posts: 58
iTrader: 4 / 100%
 

AndrewIGO is on a distinguished road

  Old  Help with JavaScript

So I was given this code in a class I'm taken, and it's directly from the book. But it doesn't show up. It's suppose to be in between two bars at the top of a web page. Can anyone take a look and see why this code isn't working?


<tr>
<td>
<hr size="5" />
<p style="margin-left:10%">
<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+" "+monthDay+" "+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>
</p>
<hr size="5" /> </td>
</tr>

Reply With Quote
     


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed