替代getElementsByTagName [英] Alternative to getElementsByTagName

查看:71
本文介绍了替代getElementsByTagName的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于getElementsByTagName()函数是新的(DOM-1?),我想要另一种更可靠的方法来根据标签名称/标识获取对元素的引用。



编辑 - 不使用框架,因为我需要缩小尺寸;所以10-20K的框架是不可接受的。我只需要可以获取元素的JS代码

解决方案

getElementsByTagName并不新鲜。根据 w3school

$ b支持IE5,FF1和Opera 7
$ b

[b]
感谢您指出这一点。自从Opera 7以来它确实得到了支持。


Since the getElementsByTagName() function is new (DOM-1?) I wanted another more reliable method to get a reference to an element based on its tag name/id.

Edit- Without using a framework, since I need to cut down on size; so 10-20K for a framework is unacceptable. I just need the JS code that can fetch an element

解决方案

getElementsByTagName is not new. It is supported since IE5, FF1 and Opera 7 according to w3schools

[edit] Thanks for pointing this out. It was indeed supported since Opera 7.

这篇关于替代getElementsByTagName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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