Table的两个属性rowIndex与cellIndex
来源:互联网 发布:新闻类网站数据库设计 编辑:程序博客网 时间:2024/05/18 22:43
rowIndex用于判断当前单元格所处行的索引(从0开始)
cellIndex用于判断当前单元格所处列的索引(从0开始)
通常我们可以把他们的事件写在TD里,因为rowIndex属性应该是属于<tr>标记,因此在判断rowIndex需要访问父节点,示例如下:
<table align="center" width="100%" height="400" cellspacing="1" border="1" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#C0C0C0" bgcolor="#C0C0C0">
<tr>
<td onclick="alert('行:'+(this.parentNode.rowIndex+1)+'列:'+(this.cellIndex+1))"> </td>
<td onclick="alert('行:'+(this.parentNode.rowIndex+1)+'列:'+(this.cellIndex+1))"> </td>
<td onclick="alert('行:'+(this.parentNode.rowIndex+1)+'列:'+(this.cellIndex+1))"> </td>
<td onclick="alert('行:'+(this.parentNode.rowIndex+1)+'列:'+(this.cellIndex+1))"> </td>
</tr>
<tr>
<td onclick="alert('行:'+(this.parentNode.rowIndex+1)+'列:'+(this.cellIndex+1))"> </td>
<td onclick="alert('行:'+(this.parentNode.rowIndex+1)+'列:'+(this.cellIndex+1))"> </td>
<td onclick="alert('行:'+(this.parentNode.rowIndex+1)+'列:'+(this.cellIndex+1))"> </td>
<td onclick="alert('行:'+(this.parentNode.rowIndex+1)+'列:'+(this.cellIndex+1))"> </td>
</tr>
<tr>
<td onclick="alert('行:'+(this.parentNode.rowIndex+1)+'列:'+(this.cellIndex+1))"> </td>
<td onclick="alert('行:'+(this.parentNode.rowIndex+1)+'列:'+(this.cellIndex+1))"> </td>
<td onclick="alert('行:'+(this.parentNode.rowIndex+1)+'列:'+(this.cellIndex+1))"> </td>
<td onclick="alert('行:'+(this.parentNode.rowIndex+1)+'列:'+(this.cellIndex+1))"> </td>
</tr>
</table>
- Table的两个属性rowIndex与cellIndex
- Table的两个属性rowIndex与cellIndex
- Table的两个属性rowIndex与cellIndex
- Table的两个属性rowIndex与cellIndex
- Table的两个属性rowIndex与cellIndex
- table的 rowIndex 属性
- node,tag,parentNode,parentElement,cells,rows,cellIndex,rowIndex,sectionRowIndex......
- HTML DOM rowIndex 属性
- table的属性与js即时获取table属性问题
- table的RULES属性
- table的border属性
- TABLE的logging属性
- Table的title属性
- table标签的属性
- 两个清爽的table样式
- window.event.srcElement.parentElement.parentElement.rowIndex;与r.parentNode.parentNode.rowIndex
- GCC的两个属性
- input的两个属性
- 我的职业生涯规划书
- VPN - 概述
- 一个比较好用的文本编辑器FreeTextBox
- Filter的使用(一)
- Nokia 手机 号码 同 HTC 同步
- Table的两个属性rowIndex与cellIndex
- 在Ncurses中显示汉字,支持中文
- 未来的创新者来自哪里?
- Flurry:多功能手机应用服务网站
- eclipse中源代码编辑器
- yaffs2文件系统的制作
- Unicode 和字符集的最基础的知识
- 未来的创新者来自哪里?
- VM+linux网络设置