views:

51

answers:

2

Whats the difference between document.getElementById() and document.ie8_getElementById().

Thanks in adv.

+1  A: 

IE8 mode, getElementById performs a case-sensitive match on the ID attribute only. In IE7 mode and previous modes, this method performs a case-insensitive match on both the ID and NAME attributes, which might produce unexpected results.

http://msdn.microsoft.com/en-us/library/ms536437%28VS.85%29.aspx

Martin Smith
+2  A: 

From MSDN: In IE8 mode, getElementById performs a case-sensitive match on the ID attribute only. In IE7 mode and previous modes, this method performs a case-insensitive match on both the ID and NAME attributes.

In other words, it works like the rest of the world in ie8 mode. You should always call getElementById, it just works differently in different versions of ie.

Keith Rousseau