Jump to content

document.getElementById(...)is leeg of geen object


Guest Juiice

Recommended Posts

keep getting that error when I open my page in internet explorer... can't seem to find out what it is that I am doing wrong :SThe main page is located at http://homepages.adc.fcj.hvu.nl/1182816/portfolio/home.htm and the javascript is located at http://homepages.adc.fcj.hvu.nl/1182816/po.../styles/home.jsIf you got any clue what might be wrong, please say so becouse I am completely new at javascripting.

Link to comment
Share on other sites

Nope, not allowed.En Juiice, om die fout uit te leggen: als er een foutmelding wordt weergegeven dat .getSomeThing(...) leeg is of geen object is, betekent dat, dat die instructie niet gevonden kan worden op je document :(In dit geval was het dat je opgegeven hebt dat het moet zoeken naar een element met een speciaal ID naam, maar niet WELK :) En tja, dan kan hij het niet vinden ook :)Je zou het zo moeten schrijven:if (document.getElementById("een_of_andere_ID")){...}Deze instructie vraagt of dat element aanwezig is, zo ja, dan voert het de script regels tussen ze accolades uit :DTranslation: what that error meant, and how she should prevent that error specially in this situation.

Link to comment
Share on other sites

Nope, not allowed.En Juiice, om die fout uit te leggen: als er een foutmelding wordt weergegeven dat .getSomeThing(...) leeg is of geen object is, betekent dat, dat die instructie niet gevonden kan worden op je document :DIn dit geval was het dat je opgegeven hebt dat het moet zoeken naar een element met een speciaal ID naam, maar niet WELK :) En tja, dan kan hij het niet vinden ook :)Je zou het zo moeten schrijven:if (document.getElementById("een_of_andere_ID")){...}Deze instructie vraagt of dat element aanwezig is, zo ja, dan voert het de script regels tussen ze accolades uit :)Translation: what that error meant, and how she should prevent that error specially in this situation.

Psh, yeah. Totally got that... :(
Link to comment
Share on other sites

Maybe in Dhtml, you could be right. I don't recognise it inside JavaScript used in Xhtml, nor when used in Html (does that make any difference :) ?)But according to me, GetElemetById should also define which Id, don't blame me if I'm still wrong; I'm no expert, only read lots of codes. Never found it without the Id definition :D@ Jonas & Chocolate570: I just explained in Dutch because I instandly recognised my own laguage in her Error message :(Tried to make it clear to you :)

Translation: what that error meant, and how she should prevent that error specially in this situation.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...