<table>
<tr onclick="alert('这是第'+this.rowIndex+'行')">
<td>ghd</td>hfdhd<td>hdhdf</td>hdgd<td>hdfhg</td><td>hgdhd</td></tr>
<tr onclick="alert('这是第'+this.rowIndex+'行')>
<td>ghd</td>hfdhd<td>hdhdf</td>hdgd<td>hdfhg</td><td>hgdhd</td></tr>
<tr onclick="alert('这是第'+this.rowIndex+'行')>
<td>ghd</td>hfdhd<td>hdhdf</td>hdgd<td>hdfhg</td><td>hgdhd</td></tr>
<tr onclick="alert('这是第'+this.rowIndex+'行')>
<td>ghd</td>hfdhd<td>hdhdf</td>hdgd<td>hdfhg</td><td>hgdhd</td></tr>
</table>rowIndex从0开始,就是行号!
<tr onclick="alert('这是第'+this.rowIndex+'行')">
<td>ghd</td>hfdhd<td>hdhdf</td>hdgd<td>hdfhg</td><td>hgdhd</td></tr>
<tr onclick="alert('这是第'+this.rowIndex+'行')>
<td>ghd</td>hfdhd<td>hdhdf</td>hdgd<td>hdfhg</td><td>hgdhd</td></tr>
<tr onclick="alert('这是第'+this.rowIndex+'行')>
<td>ghd</td>hfdhd<td>hdhdf</td>hdgd<td>hdfhg</td><td>hgdhd</td></tr>
<tr onclick="alert('这是第'+this.rowIndex+'行')>
<td>ghd</td>hfdhd<td>hdhdf</td>hdgd<td>hdfhg</td><td>hgdhd</td></tr>
</table>rowIndex从0开始,就是行号!
解决方案 »
- 求助正则表达式:0.5至100的写法
- firefox中在div插入frame时总是超出,求帮助
- 新闻发布系统中,如何把评论和相应的新闻关联起来?
- 用jquery的easyui控件中的使用ajax url使用问题
- js cookie得到多个cookie中的单个cookie对应的值
- eval执行操作如何避免true=1?
- 谁能给我入门级的JS项目实例代码大全
- @ @ @ @ @ @问个简单点的东西!呵呵!浮动提示菜单的问题@ @ @ @ @ @
- 高难问题,如何实现?有分相送!
- 求问大佬:用于获取url中的属性值的getQueryString不能成功运行是为啥
- 一个小问题,在线等待...
- javascript中使用application的用法
<tr>
<td onclick="alert('这是第'+this.parentNode.rowIndex+'行\n第'+this.cellIndex+'列)">ghd</td>hfdhd<td onclick="alert('这是第'+this.parentNode.rowIndex+'行\n第'+this.cellIndex+'列)">hdhdf</td>hdgd<td>hdfhg</td><td onclick="alert('这是第'+this.parentNode.rowIndex+'行\n第'+this.cellIndex+'列)">hgdhd</td></tr>
<tr >
<td onclick="alert('这是第'+this.parentNode.rowIndex+'行\n第'+this.cellIndex+'列)">ghd</td>hfdhd<td onclick="alert('这是第'+this.parentNode.rowIndex+'行\n第'+this.cellIndex+'列)">hdhdf</td>hdgd<td onclick="alert('这是第'+this.parentNode.rowIndex+'行\n第'+this.cellIndex+'列)">hdfhg</td><td onclick="alert('这是第'+this.parentNode.rowIndex+'行\n第'+this.cellIndex+'列)">hgdhd</td></tr></table>那就改为 onclick="alert('这是第'+this.parentNode.rowIndex+'行\n第'+this.cellIndex+'列')
你搜索一下教程,多的很。我已经无数遍回答过别人这种问题。入门击的教材:javascript网页彻底研究---陈会安 人民邮电出版社 标旗出版股份有限公司差不多之后看:javascript完全手册 --电子工业出版社 红皮书javascript使用手册 --机械工业出版社 黑皮书 很经典的!我就靠这几本书起家的!