复制代码代码如下:
<! DocType html public "-// w3c // dtd xhtml 1.0 Transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transicional.dtd ">
<html xmlns = "http://www.w3.org/1999/xhtml">
<Evista>
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<title> 无标题文档 </title>
<Meta name = "generador" content = "editplus">
<Meta name = "autor" content = "">
<Meta name = "Keywords" content = "">
<Meta name = "descripción" content = "">
<script type = "text/javaScript">
función showhide (obj) {
var objin = obj.ParentElement.ParentElement.Rows [1] .style;
// var objin = obj.ParentElement.ParentElement.ParentElement.Rows [1] .style;
objin.display == "Ninguno"? Objin.display = "bloque": objin.display = "ninguno";
}
</script>
</ablo>
<Body>
<TABLE CELLPADDING = "0" CellSpacing = "0">
<Tbody>
<tr>
<td style = "cursor: puntero;" onClick = "showhide (this)"> ¡Haz clic en mí! </td>
</tr>
<tr>
<TD> <Table>
<tr> 1111111111111111 </tr>
<tr> 22222222222222222 </tr>
<tr> 33333333333333333 </tr>
<tr> 44444444444444444 </tr>
<tr> 55555555555555555 </tr>
</table> </td>
</tr>
</tbody>
</table>
</body>
</Html>
</body>
</html>
感觉这个挺好 , 可以捕获当前事件作用的对象 如 如 如 如 Event.srcelement.tagname 可以捕获活动标记名称。
注意获取的标记都以大写表示 , 如 "Td", "tr", "A" 等。
偶应用 Evento. Sprelement 把以前的一个代码重写了下 , 扩展了其功能 很简单的一段代码。
复制代码代码如下:
<! DocType html public "-// w3c // dtd xhtml 1.0 Transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transicional.dtd ">
<html xmlns = "http://www.w3.org/1999/xhtml">
<Evista>
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<title> 无标题文档 </title>
<Meta name = "generador" content = "editplus">
<Meta name = "autor" content = "">
<Meta name = "Keywords" content = "">
<Meta name = "descripción" content = "">
<script type = "text/eCMAScript">
función tdClick () {
if (event.srcelement.tagname.tolowercase () == 'td') {
alerta ("行:"+(event.srcelement.parentnode.rowindex+1)+"列:"+(event.srcelement.CellIndex+1));
// alerta ("行:"+(event.sricleement.parentelement.rowindex+1));
}
}
</script>
</ablo>
<Body>
<table align = "Center" onClick = "tdClick ()" cellspacing = "1" borderColor = "#000000" BorderColorlight = "#000000" BorderColordark = "#C0C0C0" BGCOLOR = "#C0C0C0">>
<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>
</body>
</html>
对于以上 Tabla 中用 BorderColark 和 BorderColorlight 的说明如下:
HTML 中 BorderColark 和 BorderColorlight 的区别
窗体要呈现立体感时 , 需要两个边框为亮色 , 剩下两个边框为暗色。BorderColorlight 和 BorderCollark 分别代表亮色和暗色。