Este artigo descreve o método do JS para expandir ou ocultar linhas de mesa clicando no mouse. Compartilhe para sua referência. O método de implementação específico é o seguinte:
A cópia do código é a seguinte:
<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // pt" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-bransitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<título> js implementa o mouse clique para expandir/ocultar linhas de mesa </ititle>
</head>
<Body>
<Script Language = "JavaScript">
função testblack (tagname) {
var obj = document.getElementById (tagname);
if (obj.style.display == "") {
obj.style.display = "nenhum";
}outro{
obj.style.display = "";
}
}
</script>
<tabela CellPacing = "0" CellPadding = "0">
<tr onclick = "testblack ('divc');">
<td bgcolor = "#00ccff"> clique em mim! </td>
</tr>
<tr id id = "divc">
<td bgcolor = "#9966ff"> </td>
</tr>
</tabela>
</body>
</html>
Espero que este artigo seja útil para a programação JavaScript de todos.