Week 04: Assignment – Debugging

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
<!DOCTYPE html>
<html lang="en">
<head>
<meta 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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Web Development Courses, Rants, Tutorials and Hacks