Construct checkbox with Javascript
I have a web page with a table. I have a function that inserts a new row into that table:
function slow_insertRow(n)
{
r = document.getElementById('theTable').insertRow(n)
return r
}
and then I insert a series of cells into the row using, for example: c0 = r.insertCell(0)
In one of the cells, I want to create a checkbox. Now, I can simply write the HTML for a checkbox into the cell (by setting the innerHTML of the cell) - but that is no good because I cannot subsequently get a handle on the checkbox object (in fact, the object does not even exist).
So - how can I create a checkbox object in javascript, and insert it into my cell? When I have done that, I want to set its properties, such as id and value etc.
Hope you can help me achieve this. Thanks.
|