Javascript & JQuery & CSS > example - üũ¹Ú½º Ŭ¸¯ ½Ã ÇØ´ç Å×À̺í(table) ÁÙ(tr) ¹è°æ»ö º¯°æÇϱâ
µî·ÏÀÏ : 2020-12-17 12:18
Á¶È¸¼ö : 53,086
<script>
function setBg(t) {
td = t.parentNode;
td.style.backgroundColor = (t.checked) ? "blue" : "white";
tr = t.parentNode.parentNode;
tr.style.backgroundColor = (t.checked) ? "#FFBB00" : "#fff";
}
</script>
</head>
<body>
<table width="100%;" border=1 cellspacing=0 cellpadding=5>
<tr>
<td width=20><input type="checkbox" onclick="setBg(this)"></td>
<td>üũ¹Ú½º1</td>
</tr>
<tr>
<td><input type="checkbox" onclick="setBg(this)"></td>
<td>üũ¹Ú½º2</td>
</tr>
<tr>
<td><input type="checkbox" onclick="setBg(this)"></td>
<td>üũ¹Ú½º3</td>
</tr>
</table>
</body>
</html>