IE报错,ff op 不。谁能解释一下?

运行代码 [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

codingforums 的回复有二:

_Aerospace_Eng_:

You can’t use an ID more than once so its likely getting confused on what id to use.

Harry Armadillo:

IE treats every name and id as a global read-only variable that references the element with that name or id. You can’t have a global variable with the same name as an element’s name or id — your variable will be overwritten by the read-only element reference.

For the sake of backwards (and IE is very backwards) compatibilty, Firefox will allow to access elements using their id as a variable (but will show a warning in the javascript console). Defining your own global variables will overwrite that element-reference.

但似乎id并不是只读的。

运行代码 [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

[Edit on 2005-7-1 9:07:23 By guoshuang]