document.getElementById … has no properties
This isn't a big deal, but it was something I was fighting with for a bit. If you're trying to set the properties of a DIV via javascript, and you're getting the "document.getElementById("mydiv") has no properties" javascript warning, there's probably two big things that will cause it.
1) you didn't set the id.
Go back and make sure your div has id="mydiv" (or whatever you named it) in there.
2) the javascript is running BEFORE the div has been defined in the code.
This is what got me. I had the javascript code just above where the div was… and at load time, that div doesn't exist yet… the browser hasn't gotten that far down the page yet, so as far as it's concerned, that div with that id, doesn't exist. Once I moved the javascript BELOW the div… all was well.
And actually here - they suggest calling it on onload.
September 11th, 2007 at 6:14 am
alternatively you can figure out loading things like this ondomready. Find versions of it as part of mootools, jquery, or the original hack on dean edwards site, er, here:
http://dean.edwards.name/weblog/2006/06/again/
September 24th, 2007 at 8:01 am
Cheers for that - I was a victim of number 2 for a WEEK.
How stupid do I feel?
October 3rd, 2007 at 7:53 am
OMG thank you! I have one of your scripts bookmarked and happened to click through to your homepage and this quickly addressed a problem I've been avoiding on a site thats launching next week!
January 22nd, 2008 at 4:50 am
Thank you!! FF doesn't suppot 'name' alone, but IE6 Does. Your answer is very good!!
March 29th, 2008 at 9:33 pm
#2 - I feel like a bloody idiot…
April 21st, 2008 at 3:14 pm
#2 — put me in the ranks of 'bloody idiot' as well :-O Thanks!
May 8th, 2008 at 12:54 pm
OMG! thank you so much!!! #2 … sigh…
June 10th, 2008 at 4:39 pm
#2 was killing me. Thank you!
July 7th, 2008 at 1:35 am
#2! I was so stupid! Thank you VERY MUCH!!!
July 22nd, 2008 at 12:43 am
One more fool here you helped with #2. Thanks!
July 27th, 2008 at 2:04 pm
yes, uff, 5 hours searching and comparing. just the () in window.onload = initAll() broke it - thanks to you i started searching in the right spot… #2 sucks and in the tutorials i read they didn't really point out that possibility