Browser Compatibility Modifications for a Web Page Calendar - Special Modification of the showMonth() Function
(Page 2 of 4 )
We addressed the table cells using their IDs. Here, we give the Input Text elements the same IDs as the table cells. Thus, the JavaScript code remains unchanged, except for the line in the for-loop that has to write the number for the day of the month, or the lines in the for-loops that write the space characters.
The line that has to write the number for the day of the month was:
document.getElementById(tdID).innerHTML = monthDayNo;
It is now:
document.getElementById(tdID).value = monthDayNo;
The "innerHTML" is used to set the content of a table cell. For Input Text elements, we use "value," as in the above statement. The line in the for-loop that writes the space character was:
document.getElementById(tdID).innerHTML = " ";
It is now:
document.getElementById(TDID).value = " ";
Note the value attribute in the line. Also, note that “ ” has been assigned, and not " ". This is because the value for the attribute of the Input Text element considers " " literally and would display it as such.
Next: The Container for the Yearly Calendar >>
More HTML Articles
More By Chrysanthus Forcha