![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Some debugging reveals that this problem only occurs with pure numerical IDs!!! |
#3
| |||
| |||
|
|
arghh.. I am writing a web app for real-time streaming of market data (equities) and am implementing a quick getElementsById function as needed; in gecko FF this is a walk with document.evaluate. In IE i am using document.all (i presume this is the only efficient alternative for IE, am i correct?).. Anyway the madness is this: var _sID = "501"; // some arbitrary ID which exists in the hierarchy. |
|
Some debugging reveals that this problem only occurs with pure numerical IDs!!! So pre-pending any market code with an arbitrary string solves the problem!!! Truly i would love to know what the IE team was thinking when they implemented this collection!!! |
#4
| |||
| |||
|
|
am implementing a quick getElementsById function |
|
In IE i am using document.all (i presume this is the only efficient alternative for IE, am i correct?).. |
#5
| |||
| |||
|
|
JT wrote: am implementing a quick getElementsById function I assume you mean getElementById (singular, not plural) |
#6
| |||
| |||
|
|
On 15 Apr, 13:19, JT <jamie.taleyark... (AT) gmail (DOT) com> wrote: Some debugging reveals that this problem only occurs with pure numerical IDs!!! If it doesn't begin with a letter (not a digit), then it can't be a well-formed NAME or ID token, thus isn't well-formed to use in an attribute (such as id) that is declared as being of type ID. If you validated your HTML, you'd see this. http://www.w3.org/TR/html4/types.html#type-id This rarely causes a problem for the display of HTML, however it does cause trouble (as you've seen) with getElementById() etc. |
#7
| |||
| |||
|
|
JT wrote: am implementing a quick getElementsById function I assume you mean getElementById (singular, not plural) In IE i am using document.all (i presume this is the only efficient alternative for IE, am i correct?).. getElementById works in IE just fine. Have you tried it? -- Berg |
#8
| |||
| |||
|
|
On Apr 15, 6:49 pm, Bergamot <berga... (AT) visi (DOT) com> wrote: JT wrote: am implementing a quick getElementsById function I assume you mean getElementById (singular, not plural) In IE i am using document.all (i presume this is the only efficient alternative for IE, am i correct?).. getElementById works in IE just fine. Have you tried it? -- Berg Nope i did mean getElementsById, getElementById only returns one object irrespective of how many objects with the same ID exist. In this case i may have the same market data appear in different DIV elements and this just want to return an array of all Divs with that ID; something getElementById will not do. cheers. |
#9
| |||
| |||
|
|
Say what? There ain't no "getElementsById", bro. |
|
Some say there _is_ a "getElementsByName" |
#10
| |||
| |||
|
|
Nope i did mean getElementsById, getElementById only returns one object irrespective of how many objects with the same ID exist. In this case i may have the same market data appear in different DIV elements and this just want to return an array of all Divs with that ID; something getElementById will not do. cheers. |
![]() |
| Thread Tools | |
| Display Modes | |
| |