E
e271828
Is there a way to specify more than one row or cell collection in the
JS table object? Consider this:
var x=document.getElementById('myTable').rows[1].cells
x[0].innerHTML="NEW CONTENT"
This selects the second row (rows[1]) and the first cell (x[0]). How
would I select the first and second rows, and first - fifth rows, for
example? I would think something like the following:
var x=document.getElementById('myTable').rows[0,1].cells
x[0,1,2,3,4].innerHTML="NEW CONTENT"
or perhaps
var x=document.getElementById('myTable').rows[0-1].cells
x[0-4].innerHTML="NEW CONTENT"
But neither works. Any suggestions? A test example is here:
http://www.w3schools.com/js/tryit.asp?filename=try_dom_tablerow_cells.
JS table object? Consider this:
var x=document.getElementById('myTable').rows[1].cells
x[0].innerHTML="NEW CONTENT"
This selects the second row (rows[1]) and the first cell (x[0]). How
would I select the first and second rows, and first - fifth rows, for
example? I would think something like the following:
var x=document.getElementById('myTable').rows[0,1].cells
x[0,1,2,3,4].innerHTML="NEW CONTENT"
or perhaps
var x=document.getElementById('myTable').rows[0-1].cells
x[0-4].innerHTML="NEW CONTENT"
But neither works. Any suggestions? A test example is here:
http://www.w3schools.com/js/tryit.asp?filename=try_dom_tablerow_cells.