Lab 8

Create a web page that has two input tags of type text. Give them both an id, such as leftOp and rightOp. Next you will create a function called generateTimesTable() that will generate a HTML table of 11 columns and 11 rows and display the product of the two text inputs (leftOp and rightOp). Use a for loop and a nested for loop to generate a times table.

  2        3
leftOp * rightOp

 *   1  [2]  3 .. 10
 1   1   2   3 .. 10
 2   2   4   6 .. 20
[3]  3  [6]  9 .. 30
 .   .   .   .    .
 .   .   .   .    .
 .   .   .   .    .
10  10   20  30   100

This function will be called for the event of an onchange or onblur for the input elements calling the generateTimesTable function. Before outputting the table, get the innerHTML of the two operand text elements and store the values. While generating the times table, change the text color of the colm value to red when the col value is equal to the left operand. Change the text color of the row value to red when the row value is equal to the right operand. Change the color of the product value within the times table to red when the left operand * the right operand is equal to the product value.