Jump to content

Cannot Find The Syntax Error


jimfog

Recommended Posts

Do you see any syntax error in the code below:

function Calendar(month, year) {  [b]this.month = (isNaN(month) || month == null) ? cal_current_date.getMonth() : month;  [/b]this.year  = (isNaN(year) || year == null) ? cal_current_date.getFullYear() : year;  this.html = '';}

I am referring specifically to the 1st line(the one in bold), both Dw and Netbeans "say " that there is a syntax error there. I do not see any error.

Link to comment
Share on other sites

How do you know there is a syntax error there? Did the error console give you any messages? The only problem I see is that cal_current_date doesn't seem to exist.

Link to comment
Share on other sites

In netbeans, beside the line i see the usual exclamation mark and when i hover above it a message pops up saying syntax error. In the firebug error console i get the following message:SyntaxError: missing } in XML expression Here is the strange part-when i remove the curly brackets...{} the error is no more. I cannot understand why that happens, curly brackets are needed in order to enclose the code. The whole code is here http://s3.amazonaws.com/scottandrew-html/calendar-lesson-1.1.html Just plug it into firebug console and see the result.

Link to comment
Share on other sites

I fixed it. I did a mistake. I included the whole code in a js file and i made the mistake to enclose it in script tags.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...