CSCI-121 Lab #4 Observations
Things the lab submission should have included:
- A file named lab4.html.
- Appropriate title and H1.
- Table with proper caption and including 144 (12x12) cells.
- An id scheme (format) for TDs in the header row, another for the header column, and a third for each of the multiplication table products.
- Proper buttons below the table.
- A "Fill Headers" button that when clicked caused fillHeaders() function to be called.
- The fillHeaders() function that:
- Had a single for loop.
- Within the for loop calculated two different ID values, one for the header row, one for the header column.
- Used another function, getLabel() to get the label to place in header row, header column cell within the loop.
- Used document.getElementById() within the loop to set the header row, header column cell to the label.
- A "Fill Table" button that when clicked caused fillTable() function to be called.
- The fillTable() function that:
- Had a for loop within a for loop (outer loop for row, inner loop for column).
- Within the loop calculated the ID for addressing the multiplication product.
- Used document.getElementById() to get the TD and set its innerHTML to the product.
- Link for emailing grade back.
Things several seemed to get wrong and/or are having difficulty with:
- For loop concepts (the three statements, loop variable).
- Switch statement - it's syntax. You were warned it would be in the lab.
- String manipulation, especially concatenation: var str = "x" + 0;
- Use of IDs for "addressing" elements, use of document.getElementById() and related concepts.
- General reasons for using a function (re-use, break down a complex problem into smaller parts, etc).