Thats a normal javascript newcomer error. You'll be fine when you understand it (wont take much). Welcome aboard!
-- Fábio Miranda Costa Solucione Sistemas Engenheiro de interfaces On Mon, Mar 1, 2010 at 11:01 AM, Thierry bela nanga <bna...@gmail.com>wrote: > > window.addEvent('domready', testDomready()); //the () causes testDomready > to be run immediately > > what you should do is passing the function reference like this: > > window.addEvent('domready', testDomready); > > > On Mon, Mar 1, 2010 at 2:58 PM, Slik Jay <slik....@gmail.com> wrote: > >> window.addEvent('domready', testDomready()); // wrong >> window.addEvent('domready', testDomready); // good >> >> On Mon, Mar 1, 2010 at 3:54 PM, Chrono <chrono-onl...@web.de> wrote: >> > Hello everybody, >> > >> > I have a strange behaviour in my dodument: >> > >> > <html> >> > <head> ...mootools.js ...</head> >> > <body> >> > <script type="text/javascript"> >> > //<![CDATA[ >> > >> > function testDomready(){ >> > alert($('test_div')); >> > }; >> > } >> > >> > window.addEvent('domready', testDomready()); >> > >> > //]]> >> > </script> >> > <div id="test_div"></div> >> > >> > </body> >> > </html> >> > >> > If I open the page, I get an alert with "null"! >> > So, I have no idea, why domready fires before the page is completely >> > loaded? >> > >> > I hope someone can help me! >> > >> > Greets >> > Chrono >> > >> > > > > -- > http://tbela99.blogspot.com/ > > fax : (+33) 08 26 51 94 51 >