prettynpink
03-24-2009, 04:40 AM
I am trying to debug some code. I have found some typos and missing parts however now I am stuck as to what to do next in order for this to work. I added in comments at the parts of the code where I think the problems are but do not really know how to fix them.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Days of the Week</title>
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1" />
<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
/* <![CDATA[ */
// This item is not defined. Not sure why this item here...
printDays();
/* ]]> */
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</head>
<body>
<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
/* <![CDATA[ */
function printDays() {
var daysOfWeek = new Array(7);
daysOfWeek[0] = "Monday";
daysOfWeek[1] = "Tuesday";
daysOfWeek[2] = "Wednesday";
daysOfWeek[3] = "Thursday";
daysOfWeek[4] = "Friday";
daysOfWeek[5] = "Saturday";
daysOfWeek[6] = "Sunday";
var count = 0; //Can I use this var in the way that I am?
do {
document.write(daysOfWeek[count] + "<br />"); //would the function be called like this or with using printDays instead?
count++;
} while (count <= 6);
}
/* ]]> */
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</body>
</html>
Thanks in advance for any info you can give me. If you can point me to a good online source for help with JavaScript that would be great. I am really new to this and my class is starting to get where I am getting a little lost.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Days of the Week</title>
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1" />
<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
/* <![CDATA[ */
// This item is not defined. Not sure why this item here...
printDays();
/* ]]> */
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</head>
<body>
<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
/* <![CDATA[ */
function printDays() {
var daysOfWeek = new Array(7);
daysOfWeek[0] = "Monday";
daysOfWeek[1] = "Tuesday";
daysOfWeek[2] = "Wednesday";
daysOfWeek[3] = "Thursday";
daysOfWeek[4] = "Friday";
daysOfWeek[5] = "Saturday";
daysOfWeek[6] = "Sunday";
var count = 0; //Can I use this var in the way that I am?
do {
document.write(daysOfWeek[count] + "<br />"); //would the function be called like this or with using printDays instead?
count++;
} while (count <= 6);
}
/* ]]> */
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</body>
</html>
Thanks in advance for any info you can give me. If you can point me to a good online source for help with JavaScript that would be great. I am really new to this and my class is starting to get where I am getting a little lost.