浏览器&标准 [英] browsers & standards

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

问题描述

我被告知引用页面内容的标准方式是

document.getElementById()


每种浏览器类型的最低版本是什么这将是什么?
工作?


谢谢

I''m told the standards way of referencing page content is
document.getElementById()

What is the lowest version of each browser type with which this will
work?

Thank you

推荐答案

ab**********@yahoo.com 上述以下内容2005年11月6日下午4:54:
ab**********@yahoo.com said the following on 11/6/2005 4:54 PM:
我被告知引用页面内容的标准方式是
document.getElementById()

什么是每个浏览器类型的最低版本,它将用于什么?
I''m told the standards way of referencing page content is
document.getElementById()

What is the lowest version of each browser type with which this will
work?




支持它的最低版本是最低版本将

通过了这个测试:


if(document.getElementById)


意思是,你做对象/特征检测并且没有'没问题。


-

兰迪

comp.lang.javascript常见问题 - http://jibbering.com/faq &新闻组每周

Javascript最佳实践 - http://www.JavascriptToolbox .com / bestpractices /



The lowest version that will support it is the lowest version that will
pass this test:

if (document.getElementById)

Meaning, you do object/feature detection and it doesn''t matter.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


ab * *********@yahoo.com 写道:
ab**********@yahoo.com wrote:
我被告知引用页面内容的标准方式是
文件。 getElementById()

每种浏览器类型的最低版本是什么?这将是什么?
I''m told the standards way of referencing page content is
document.getElementById()

What is the lowest version of each browser type with which this will
work?




即使是最新的浏览器可能不支持它。你需要测试它


if(document.getElementById){//用document.getElementById()做什么东西


Mick



Even the most recent browsers may not support it. You need to test for it

if(document.getElementById){// do stuff with document.getElementById()}

Mick


ab ********** @ yahoo.com 写道:
我被告知引用页面内容的标准方式是
document.getElementById()

什么是每个浏览器类型的最低版本,它将用于什么?
I''m told the standards way of referencing page content is
document.getElementById()

What is the lowest version of each browser type with which this will
work?




一般建议是大多数浏览器支持getElementById

*在* Netscape 4和IE 4之后出现*几乎所有在过去几年中发布的所有浏览器都支持它 - 它得到了更广泛的支持

比document.all和document.layers已经死了。


但请注意Randy& Mick的建议:仅仅因为浏览器是新的或

支持JavaScript并不意味着它支持任何特定的方法或

界面,这对于移动设备来说尤其如此浏览器。

始终需要进行特征检测和优雅后退。


还有其他方法可以获得更多元素的引用

适当取决于环境,例如链接,图像和

形成集合或遍历DOM(父节点和子节点,兄弟节点,

等) 。

-

Rob



General advice is that getElementById is supported by most browsers that
emerged *after* Netscape 4 and IE 4. Nearly all browsers that have been
released in the last few years support it - it''s more widely supported
than document.all and document.layers is pretty much dead.

But take heed of Randy & Mick''s advice: just because a browser is new or
supports JavaScript does not mean it supports any particular method or
interface, which seems to be particularly true of mobile browsers.
Feature detection and graceful fall-back is always required.

There are other ways of getting references to elements that may be more
appropriate depending on the circumstance such as the links, images and
forms collections or traversing the DOM (parent & child nodes, siblings,
etc.).
--
Rob


这篇关于浏览器&标准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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