-
Recent Posts
Recent Comments
Tags
adodb ajax android apache arguments box cache calendar css db document.ready EAN-13 excel forbidden framework getElementsByName hello world html IE java Javascript js keycode lazyload linux margin-top margin折叠 memcache mysql null php preload image QR Code session smarty wordpress xml 子主题 条形码 浮点数 盒子 质数 闲聊 雪 页面优化My Firends
Archives
Meta
Tag Archives: IE
getElementsByName in IE6
虽然很讨厌IE6,但又不得不时时刻刻去关心它。
虽然IE已经出到了v9,同时safari、firefox、chrome的正不断崛起,但显然、至少在国内、IE6依然是主流。
作为一个网站管理员,我管理的网站大约仍有30%的访问是由IE6执行的!真是一个灾星 -_-!!
可能你也和我一样,正经历着IE6的煎熬,下面是典型的例子。
若干年前,刚刚踏进Web开发领域,在使用getElementsByName时我是这样用的:
var a=document.getElementsByName("tt");
alert(a.length);
它没有问题,因为只需要针对IE6就行了,这是IE6的一个惊人的“能力”,它能将ID等同于Name
过了段时间,当我需要需要对Firefox等浏览器做兼容时发现,我必须使用Name属性才行。
于是我改成:
var a=document.getElementsByName("tt");
alert(a.length);
但在IE6中,它失效了。
(more…)
Tagged getElementsByName, IE, Javascript