html - JavaScript syntax error (I think) -


i'm working on homework class , copied code straight out of book , it's not working. problem copyright() function isn't displaying. countdown() function being display somewhere else , works perfectly. see i'm doing wrong here?

function countdown() {     var today = new date()     var dayofweek = today.tolocalestring()     daylocate = dayofweek.indexof(" ")     weekday = dayofweek.substring(0, daylocate)     newday = dayofweek.substring(daylocate)     datelocate = newday.indexof(",")     monthdate = newday.substring(0, datelocate+1)     yearlocate = dayofweek.indexof("2013")     year = dayofweek.substr(yearlocate, 4)      var bridalexpo = new date("february 12, 2014")     var daystogo = bridalexpo.gettime()-today.gettime()     var daystobridalexpo = math.ceil(daystogo/(1000*60*60*24))      displaycountdown.innerhtml = "<p style='font-size:12pt; font-family: helvetica;'>today "         +weekday+" "+monthdate+" "+year+". have "+daystobridalexpo+         " days until midwest bridal expo.</p>" }  function copyright() {     var lastmoddate = document.lastmodified     var lastmoddate = lastmoddate.substring(0,10)     displaycopyright.innerhtml = "<p style='font-size:12pt; font-family:helvetica;'>today "         +weekday+" "+monthdate+" "+year+". have "+daystobridalexpo+         " days until midwest bridal expo.</p>" } 

the body tag looks this: (the other 2 functions work great)

<body onload="scrollcolor(); countdown(); copyright()"> 

the call copyright() function looks this:

<div id="displaycopyright"></div> 

i've been looking @ past half hour , not seeing it. first time i've written javascript though i'm missing something. appreciated!

thanks, tommy

it's not syntax error if isn't being displayed. syntax errors when write parser language doesn't understand , it's displayed in browser (firebug, developer tools, etc).

however, have 2 functions

a 

and

b 

variables defined in local variables cannot accessed function b.

local variables in cannot accessible function b shouldn't able use

daystobridalexpo  

in copyright because variables don't exist in scope.

i recommend starting more simple. have tried hello world begin , basic parametric returning? make function return needed variables function b.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -