If I have a <div id='a'>
in Chrome then in javascript I can do a.stuff()
(it's like as if a
is a global variable).
However this does not work with FireFox - I will need to use document.getElementById('a')
.
What is the correct behaviour here? (according to W3 specs that is)
Also I'm interested in how will Chrome resolve the ambiguity if I have a div with id a
yet have a global variable called a
too in my script. Is the behavior going to be random and whacky?
And how would an element with id consisting of hyphens ("-"), colons (":"), and periods (".") be translated (ok i know they can be accessed with document.getElementById
but how will the browser translate it into the global variable that was representing them)
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…