js操作table

var  x = document.getElementById('myTable').rows;
    
var  y = x[ 0 ].cells;
    y[
0 ].innerHTML = " NEW CONTENT " ;

  var  x = document.getElementById('myTable').insertRow( 2 );
    
var  y = x.insertCell( 0 );
    
var  z = x.insertCell( 1 );
    y.innerHTML
= " NEW CELL1 " ;
    z.innerHTML
= " NEW CELL2 " ;

见www.java2s.com

你可能感兴趣的:(js操作table)