체크박스를 선택하면 해당 테이블셀(TR) 색상을 변경
페이지 정보
작성자 서방님 댓글 0건 조회 409회 작성일 15-11-20 17:31본문
출처 : http://blueb.co.kr/?m=bluebdata&bid=js_forms&uid=2031&c=1/9
<html>
<head>
<title>http://www.blueb.co.kr</title>
<script>
function check(it) {
tr = it.parentNode.parentNode;
tr.style.backgroundColor = (it.checked) ? "gold" : "white";
}
</script>
</head>
<body>
<form onsubmit="return false">
<table class="test" border=1 width=400>
<tr><td width=20><input type="checkbox" onclick="check(this)"></td><td>blub-B</td><td>blub-B</td></tr>
<tr><td><input type="checkbox" onclick="check(this)"></td><td>blub-B</td><td>blub-B</td></tr>
<tr><td><input type="checkbox" onclick="check(this)"></td><td>blub-B</td><td>blub-B</td></tr>
<tr><td><input type="checkbox" onclick="check(this)"></td><td>blub-B</td><td>blub-B</td></tr>
</table>
</form>
</body>
</html>
댓글목록
등록된 댓글이 없습니다.