04-22-2009, 07:29 PM
|
#3 (permalink)
|
|
The Frequenter
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
|
Like said by Salathe, you need to execute when your dom tree is fully loaded (this is called "domready"). Most frameworks includes support for the domready event, so you can bind a new domready even and execute your code then.
The fact that this does not work is because the browser does not have a 2 stage parsing/execution stage like PHP (4 and newer) does. Meaning that once this part is parsed, the browser will execute it, so when it executes your javascript code it havn't got to the HTML elements yet, making them render as 0 :)
__________________
|
|
|