如何使用JS DOM选择此代码中的链接?

anoutconas1986

New member
亲爱的成员们,JS新手在这里需要一些帮助。HTML代码如下:<input type="image" src="http://thetargetlink.c om" border="0" accesskey="s">我想只使用JS选择该链接,但是无法找到方法,该链接没有ID和CLASS。我应该如何选择该链接呢?可以使用document.querySelector吗?请大家帮帮我!感激不尽。
 

nealifaran1987

New member
document.querySelectorAll(('table tbody tr:first-child td:first-child input[type=image]'));未经过测试,它应该可以找到所有类型为image的输入框,但如果有更多,你可能需要稍作调整。
 
document.querySelectorAll(('table tbody tr:first-child td:first-child input[type=image]'));未经过测试,它应该可以找到所有类型为image的输入框,但如果有更多,你可能需要稍作调整。我会尝试的!感谢。
 
顶部