Yes that is what would happen, but as of tapestry 4.1 we're using the built in node.addEventHandler() function most browsers support via dojo.event.connect()..
We can add as many window.onload blocks we like with this method without stepping on anyone elses code. Saying <node>.on<event>=<foo> ~will~ blow away other peoples changes. Also, this is done for you automatically in tapestry 4.1 when using the @Script component template semantics. When I finally get around to upgrading dojo waiting for these load events will be much faster than the current default window.onload semantics as the solution discussed here has recently been implemented: http://dean.edwards.name/weblog/2006/06/again/ On 8/21/06, Vinicius Carvalho <[EMAIL PROTECTED]> wrote:
Well, yeah I though I can use this, but if Tapestry is not adding the window.onload now, what happens if I have 2 scripts that need to be loaded on the same time? does something like this work: window.onload = function(){ firstScript contribution } window.onload = function(){ secondScript contribution } Because, I believe that's what you get by using : <initialization> window.onload ... </initialization> on both of your scripts right? Regards On 8/21/06, andyhot <[EMAIL PROTECTED]> wrote: > Vinicius Carvalho wrote: > > Hello there! My script is not rendering it's initialization inside a > > window.onload{}, any ideas what I might be doing wrong? > http://tapestry.apache.org/tapestry4/UsersGuide/script.html#script.initialization > describes this behavior. > window.onload waits for all images to be loaded before getting triggered. > I think Tapestry no longer uses it. It appends that code just before > </body>. > Why is this problematic in your case? > > You're also free to set window.onload yourself however... > Either with the ugly > <initialization> > window.onload = function() { > requestMsgs.send("GET",$url,true); > requestMsgs.onReadyStateChange = onMessage; > requestMsgs.send(null); > } > </initialization> > > or with dojo.connect or similar utility functions > > > > > > <body> > > <![CDATA[ > > var requestMsgs = getRequest(); > > function onMessage(){ > > if(requestMsgs.readyState == 4){ > > var response = requestMsgs.responseText; > > var content = document.getElementById('content'); > > content.innerHTML += response; > > } > > setTimeout('onMessage();',2000); //Refresh a cada 2 segundos > > } > > ]]> > > </body> > > <initialization> > > requestMsgs.send("GET",$url,true); > > requestMsgs.onReadyStateChange = onMessage; > > requestMsgs.send(null); > > </initialization> > > > > The JavaScript rendered on the page: > > > > <script type="text/javascript"><!-- > > > > > > > > var requestMsgs = getRequest(); > > function onMessage(){ > > if(requestMsgs.readyState == 4){ > > var response = requestMsgs.responseText; > > var content = document.getElementById('content'); > > content.innerHTML += response; > > } > > setTimeout('onMessage();',2000); //Refresh a cada 2 segundos > > } > > > > > > > > // --></script > > > > <script language="JavaScript" type="text/javascript"><!-- > > > > requestMsgs.send("GET",$url,true); > > requestMsgs.onReadyStateChange = onMessage; > > requestMsgs.send(null); > > > > > > // --></script> > > > > My components inherits from BaseComponent. and has a single line of code: > > <span jwcid="script"> > > just to render the JS > > > > Best regards > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > Andreas Andreou - [EMAIL PROTECTED] - http://andyhot.di.uoa.gr > Tapestry / Tacos developer > Open Source / J2EE Consulting > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind.