why cant you access first div element of body like document.body.div[0] in html/javascript -
i can document.body.childnodes[1]
why not 'document.body.div[1]'. how document special?
sorry if missing something.
following logic,and document not special, body should have been accessible through this.
document.childnodes[1]
or so. assuming div body second element.
why work this.
document.body.etc << can but...
document.body.div << not this. instead this...
document.body.childnodes[1] << works given div 2nd element!
document.childnodes[1] << why not way acces body given 2nd element [1].
document.body.div.p << want this, understanding of html object model should possible.
document.childnodes[0]
return first tag in whole document, whereas document.body.childnodes[0]
return first tag under body tag.
Comments
Post a Comment