Week 04: Assignment – Debugging

Update: April 27th, 2009

Assignment

Find and eliminate all bugs from the file below using the Firefox plugin Firebug

Debug this file: assignment_4_template.html (right click and choose ‘save as’)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!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" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Strict Template</title>
  <script type="text/javascript">
<!--
	window.onload = doStuf(); // call doStuff on page Load
 	function doStuff() {
		/* 
			this function iterates through all of the tags in this document
			and alerts whether the tag has an even array index in a string
			and what kind of tag
		/
		var getTags = document.getElementsByTagName("*"); // get all tags in document
		for (var i=0; i < getTags.lenght; i++){ // iterate through the get Tags array
			if(i%2 = 0) { //cycle through the tags array and alert if the tag is even or odd and what kind of tag it is
				document.write('this tag is even and the nodeName is " + getTags[i].nodeName);
			} else {
				documennt.write('this tag is odd and the nodeName is ' + getTags[i].nodeName);
			}
		}	
	}
//-->
  </script>
</head>
<body>
  <!--  ... content and structure goes here ...  -->
	<h1>Debug the javascript code in this file</h1>
	<div>
		<p>There is more than one way to debug JavaScript, the Firebug way is Awesome</p>
		<a href="http://www.digitalmediaminute.com/screencast/firebug-js/">Watch this video to learn how to debug in firebug</a>
  	</div>
  <!--  The following is required for your homework to be graded! -->
  <div>
    <p>File Last Modified: <script type="text/javascript">document.write( document.lastModified )</script></p>
  </div>
</body>
</html>

Publish your error free version of Assignment_04_template.html to your Assignments Page by next week’s lab

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • email
  • Reddit
  • Twitter
  • Current
  • HackerNews
blog comments powered by Disqus
TOP