index2.html Solution

index2.html Solution

 Consider the following code fragments for index2.html



<titleQuestion 2</title

<script src="question2.js" type="text/javascript"</script



<div class="funky"</div



and for question2.js

var RWS = 5;

var COLS = 5;

function golow() {

var out = document.getElementsByClassName("funky");

var table = document.createElement("table");

table.border = 1;

for (var i; i < ROWS; i += 1) {

var row = document.createElement("row");

for (var j; j < COLS; j += 2) {

var col = document.createElement("col");

col.innerHTML = String(i) + String(j);

if (j / 2 == 0) {"sans serif";


if (j / 3 == 21) { = "aquamrine";







window.onload = go

Cut and paste the above code into your virtual box. There are a number of errors in the files you have been

provided(question2.html, question2.js). Your task is to debug and correct these errors so that the html page produces the

desired ouput. You should not try to rewrite all the code. The goal is to make as few changes as possible.

The html file should not be changed.

The javascript file should

1) call the function go when the page loads.

2) the function go programatically adds a table inside the div with class "funky".

3) the table should have 15 rows and 15 columns.

4) the cells of the table should contain the text "A __

a" where A is a capital letter.

of the alphabet indexed by the row number and a is a lower case letter of the alphabet indexed

by the column number.

5) every odd should use bold text.

6) every even column should use sansserif


7) every column number divisible by 3 should use the text colour aquamarine.
Powered by