이 기사에서는 마우스를 클릭하여 테이블 행을 확장하거나 숨기는 JS의 방법에 대해 설명합니다. 참조를 위해 공유하십시오. 특정 구현 방법은 다음과 같습니다.
코드 사본은 다음과 같습니다.
<! doctype html public "-// w3c // dtd xhtml 1.0 Transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<헤드>
<meta http-equiv = "content-type"content = "text /html; charset = utf-8" />
<title> js는 마우스를 구현하여 테이블 행을 확장/숨기려면 클릭하십시오 </title>
</head>
<body>
<script language = "javaScript">
함수 testBlack (tagname) {
var obj = document.getElementById (tagname);
if (obj.style.display == "") {
obj.style.display = "none";
}또 다른{
obj.style.display = "";
}
}
</스크립트>
<table cellPacing = "0"CellPadding = "0">
<tr onclick = "testBlack ( 'divc');">
<td bgcolor = "#00ccff"> 나를 클릭하십시오! </td>
</tr>
<tr id = "divc">
<td bgcolor = "#9966ff"> </td>
</tr>
</테이블>
</body>
</html>
이 기사가 모든 사람의 JavaScript 프로그래밍에 도움이되기를 바랍니다.