如何找到a的parent node

unicode 2010-08-10 11:31:49
代码如下:

<table>
<tr>
<td><a href="javascript:test(this);">click here</a></td>
</tr>
</table>

怎么样才能在test()里访问到td or tr? this变成了window对象了.邀请不能给a添加id的
...全文
55 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
地狱羔羊 2010-08-10
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 free_wind22 的回复:]

HTML code

<table>
<tr>
<td><a href="javascript:void(0);" onclick="test(this);">click here</a></td>
</tr>
</table>



这样就可以用this了。
[/Quote]
+
2010-08-10
  • 打赏
  • 举报
回复

<table>
<tr>
<td><a href="javascript:void(0);" onclick="test(this);">click here</a></td>
</tr>
</table>


这样就可以用this了。

87,917

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧