...

View Full Version : how do i understand messages in the error console?



RintheSquid
02-13-2011, 08:33 PM
What can I do to find out what the errors in the error console mean?

DaveyErwin
02-13-2011, 08:46 PM
What can I do to find out what the errors in the error console mean?

One possible solution would be to post them here
along with the problematic code.

RintheSquid
02-13-2011, 09:01 PM
Okay. So the error console says that "calendarDay" is not defined. This is for a class. I am doing a tutorial and following the book. I have everything exactly as it is in the book and there is a little date that is not showing up in the upper right hand corner of the web page.

function calendar() {
document.write("<table id='calendar_table'>");
writeCalTitle(calDate);
document.write("</table>");
}

function writeCalTitle (calendarDay) {
var monthName = new Array ("January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December");

var thisMonth=calendarDay.getMonth();
var thisYear=calendarDay.getFullYear();

document.write("<tr>");
document.write("<th id='calendar_head' colspan='7'>");
document.write(monthName[thisMonth]+" "+thisYear);
document.write("</th>");
document.write("</tr>");
}

There's the javascript. Let me know if you want to see my HTML. Also, it has changed the navBar on the webpage and the HTML formatting is not showing up. :eek:

RintheSquid
02-13-2011, 09:04 PM
<head>
<title>The Chamberlain Civic Center</title>
<link href="ccc.css" rel="stylesheet" type="text/css" />

<link href="calendar.css" rel="stylesheet" type="text/css" />
<script src="cal.js" type="text/javascript"></script>
</head>

<body>
<div id="head">
<script type="text/javascript">
calendar();
</script>

<img src="logo.gif" alt="Chamberlain Civic Center" />
</div>

<div id="links">
<table><tr>
<td><a href="#">Home</a></td><td><a href="#">Tickets</a></td>
<td><a href="#">Events</a></td><td><a href="#">Tour</a></td>
<td><a href="#">Directions</a></td><td><a href="#">Hours</a></td>
<td><a href="#">Packages</a></td><td><a href="#">Contact Us</a></td>
</tr></table>
</div>

There's some of the HTML. I will upload the page to my school server and post the URL if you would like also.

Logic Ali
02-13-2011, 09:27 PM
[COLOR="Teal"]Okay. So the error console says that "calendarDay" is not defined.



writeCalTitle(calDate);
document.write("</table>");
}

function writeCalTitle (calendarDay) {



You are calling writeCalTitle with the parameter calDate. Where is
calDate defined?

RintheSquid
02-15-2011, 11:15 PM
Sorry, I am still getting my head around the concepts here.

So, both "calendarDay" and calDate" need to be defined as functions or as variables?
As variables, right? Because that is the parameter for the function?

RintheSquid
02-15-2011, 11:29 PM
function calendar() {
var calDate = new Date("March 18, 2011");
document.write("<table id='calendar_table'>");
writeCalTitle(calDate);
writeDayNames();
writeCalDays(calDate);
document.write("</table>");
}

function writeCalTitle (calendarDay) {
var monthName = new Array ("January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December");

var thisMonth=calendarDay.getMonth();
var thisYear=calendarDay.getFullYear();

document.write("<tr>");
document.write("<th id='calendar_head' colspan='7'>");
document.write(monthName[thisMonth]+" "+thisYear);
document.write("</th>");
document.write("</tr>");
}

When I view the page in firefox the formatting for the navigation buttons is gone...

RintheSquid
02-15-2011, 11:30 PM
title>The Chamberlain Civic Center</title>
<link href="ccc.css" rel="stylesheet" type="text/css" />

<link href="calendar.css" rel="stylesheet" type="text/css" />
<script src="cal.js" type="text/javascript"></script>
</head>

<body>
<div id="head">
<script type="text/javascript">
calendar();
</script>

<img src="logo.gif" alt="Chamberlain Civic Center" />
</div>

<div id="links">
<table><tr>
<td><a href="#">Home</a></td><td><a href="#">Tickets</a></td>
<td><a href="#">Events</a></td><td><a href="#">Tour</a></td>
<td><a href="#">Directions</a></td><td><a href="#">Hours</a></td>
<td><a href="#">Packages</a></td><td><a href="#">Contact Us</a></td>
</tr></table>
</div>

Here's some of the HTML.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum