Indonesia
<!--Langkah 1: Tambahkan kode berikut ke area kepala--> <head> <STYLE> th{background-color:#999999;} .trOdd{background-color:#FFFFFF;} .trEven{background - color:#CCCCCC;} </STYLE> <SCRIPT Language="javascript"> /** * Secara otomatis memindai tabel dan menggambar warna baris ganjil dan genap* oTable: tabel target kelas ganjil: gaya css untuk baris ganjil Kelas genap: css untuk baris genap Gaya*/ fungsi setRowColor(oTable,oddClass,evenClass) { resetTableColor(oTable); for(var i=1; i<oTable.rows.length; i++) { if(i % 2 == 0) oTable. baris[i ].className = evenClass; else oTable.rows[i].className = oddsClass; tabel target kelas ganjil: kolom ganjil gaya css Kelas genap: gaya css untuk kolom genap*/ //lebih banyak javascript dari http://www.downcodes.com function setColColor(oTable,oddClass,evenClass) { resetTableColor(oTable); =1; i<oTable .rows.length; i++) { for(var j=0; j<oTable.rows[i].cells.length; j++) { if(j % 2 == 0) oTable. baris[i].sel[j ].className = evenClass; else oTable.rows[i].cells[j].className = oddsClass; ) { untuk(var i=1; i< oTable.rows.length; i++) { oTable.rows[i].className = ""; for(var j=0; j<oTable.rows[i].cells. panjang; j++) oTable.rows[i]. sel[j].className = ""; semua.tableRow,'trOdd','trEven' ); setColColor(document.all.tableCol,'trOdd','trEven'); } fungsi perubahan() { if(changeTag) { setRowColor(document.all.tableCol,' trOdd','trEven'); setColColor(dokumen .all.tableRow,'trOdd','trEven'); changeTag = false; } else { setRowColor(document.all.tableRow,'trOdd','trEven'); (document.all.tableCol,'trOdd', 'trEven'); changeTag = true; } </SCRIPT> </head> <!--Langkah 2: Ubah konten BODY menjadi konten berikut--> <body onLoad="init()"> <!-- Langkah 3: Tambahkan kode berikut ke area BODY --> <TABLE width="70%" border="1" cellpadding="0" Cellspacing="1" bordercolor ="#000000" id="tableRow"> <TR> <TH scope="col">col1</TH> <TH scope="col">col2</TH> <TH scope="col">col3< /TH> </TR> <TR> < TD> </TD> <TD> </TD> <TD> </TD> </TR> <TR> <TD> < /TD> <TD> </TD > <TD> </TD> </TR> <TR> <TD> </TD> <TD> </TD> <TD>  ;</TD> </TR> <TR > <TD> </TD> <TD> </TD> <TD> </TD> </TR> <TR> <TD>  ;</TD> <TD> < /TD> <TD> </TD> </TR> <TR> <TD> </TD> <TD> </TD> <TD > </TD> </TR> </TABEL> <P> <TABEL lebar = "70%" border = "1" cellpadding = "0" sel spasi = "1" bordercolor = "#000000" id = tableCol"> <TR> <TH width=" 25%" scope="col">col1</TH> <TH width="25%" scope="col">col2</TH> <TH width="25 %" scope="col">col3</ TH> <TH width="25%" scope="col">col4</TH> </TR> <TR> <TD> </TD> <TD > </TD> <TD>  ;</TD> <TD> </TD> </TR> <TR> <TD> </TD> <TD> </TD> <TD> </TD> <TD > </TD> </TR> <TR> <TD> </TD> <TD> </TD> <TD> </ TD> <TD> </TD> </TR> <TR> <TD> </TD> <TD> </TD> <TD> </TD> <TD> </TD> </TR> <TR> <TD> </TD> <TD> </TD> <TD> </TD> <TD> </TD> </TR > <TR> <TD> </ TD> <TD> </TD> <TD> </TD> <TD> </TD> </TR> </TABLE><p > <input type="button" value=" Exchange " onClick="change()" style="border:1px solid black; "> </body> <!--Deskripsi kode: Deskripsi: 1. Tambahkan onLoad=" init()" menjadi <body> dan ubah For <body onLoad="init()"> 2. Fungsi function init() { setRowColor(document.all.tableRow,'trOdd','trEven'); setColColor(document. all.tableCol,'trOdd','trEven '); } tableRow, tableCol adalah nilai ID tabel untuk mengatur warna. setRowColor adalah fungsi untuk mengatur warna baris alternatif -->