如何在FireFox中的元素中通过Id查找元素 [英] how to find an element by Id in an element in FireFox

查看:213
本文介绍了如何在FireFox中的元素中通过Id查找元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IE中,我曾经使用eachElement.all(''elementId'')
查找元素 结果是具有该id的元素的缩色.
但是在FireFox中,eachElement.all是未定义的.
如何通过其ID在parentNode中找到元素.

In IE I used to find elements with eachElement.all(''elementId'')
the result was a coloection of elements with that id.
but in FireFox eachElement.all is undefined.
how can i find elements in a parentNode by their Ids.
thanks.

推荐答案

您可以使用属性childNodes代替all.

在这里查看更多信息:
http://www.w3schools.com/Dom/dom_element.asp [
You could use the property childNodes instead of using all.

Have a look here fr more info:
http://www.w3schools.com/Dom/dom_element.asp[^]

Good luck!


document.getElementById(''elementId'') 

适用于所有浏览器.


这篇关于如何在FireFox中的元素中通过Id查找元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆