Saturday, December 1, 2012

rowSpan

Properti HTMLTableCellElement.rowSpan menetapkan atau mengembalikan atribut ROWSPAN elemen TH/TD HTML.

Sintaks:

tableCellObj.rowSpan = value tableCellObj.rowSpan

value adalah number (long) yang sedikitnya satu digit di dalam cakupan 0-9.

Contoh di bawah ini mengembalikan nilai atribut ROWSPAN:

<TABLE WIDTH="50%" BORDER="1"> <TR> <TH ROWSPAN="3">row 1, header cell 1</TH> </TR> <TR> <TD>row 2, cell 1</TD> <TD>row 2, cell 2</TD> </TR> <TR> <TD>row 3, cell 1</TD> <TD>row 3, cell 2</TD> </TR> </TABLE> <SCRIPT TYPE="text/javascript"> var tableObj = document.getElementsByTagName("table")[0]; var myCell = tableObj.rows[0].cells[0]; alert(myCell.rowSpan); // 3 </SCRIPT>

Contoh di bawah menetapkan atribut ROWSPAN:

<TABLE WIDTH="50%" BORDER="1"> <TR> <TH>row 1, header cell 1</TH> </TR> <TR> <TD>row 2, cell 1</TD> <TD>row 2, cell 2</TD> </TR> <TR> <TD>row 3, cell 1</TD> <TD>row 3, cell 2</TD> </TR> </TABLE> <SCRIPT TYPE="text/javascript"> var tableObj = document.getElementsByTagName("table")[0]; var myCell = tableObj.rows[0].cells[0]; myCell.rowSpan = 3; </SCRIPT>