Re: [OT] Re: Javascript problem

2008-02-11 Thread Laurie Harper
addOnLoad() should cause the function to be executed as soon as the DOM is complete, which may be before the page has finished loading and rendering. However, since the DOM will be fully constructed, getElementById() should work properly at that point. I'd go with Dave's advice and confirm

Re: [OT] Re: Javascript problem

2008-02-11 Thread Pablo Vázquez Blázquez
If I use a hidden iframe to do the same, it works. I didn´t put the script tag in the head. I don´t understand why I should do it... I´m using Tiles and my header is reused in several pages, and this script is only valid for few ones. Thanks. Dave Newton escribió: --- Pablo Vázquez Blázquez

Re: [OT] Re: Javascript problem

2008-02-11 Thread Dave Newton
--- Pablo Vázquez Blázquez [EMAIL PROTECTED] wrote: script type=text/javascript function init() { alert(document.getElementById('name[0]')); } dojo.addOnLoad(init); /script It is the same as: script type=text/javascript

Re: [OT] Re: Javascript problem

2008-02-11 Thread Lukasz Lenart
Did you put such code inside page header's tags? Regards -- Lukasz http://www.linkedin.com/in/lukaszlenart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: [OT] Re: Javascript problem

2008-02-11 Thread Pablo Vázquez Blázquez
script type=text/javascript function init() { alert(document.getElementById('name[0]')); } dojo.addOnLoad(init); /script It is the same as: script type=text/javascript alert(document.getElementById('name[0]')); /script It is executed before the page loads. Dave

[OT] Re: Javascript problem

2008-02-11 Thread Jeromy Evans
Just one minor clarification that hasn't been mentioned elsewhere in this thread. If your HTML fragment is being loaded via XHR with Dojo, then Dojo itself is responsible for parsing the html for scripts and then executing them. This is because inserting html into the DOM via innerHTML does

[OT] Re: Javascript problem

2008-02-11 Thread Dave Newton
--- Pablo Vázquez Blázquez [EMAIL PROTECTED] wrote: Anyone knows why my javascript code is executed at the loading of a page instead when it *should*?? Mostly because of your definition of should ;) For example, I have a .jspx page with a form: form ... input id=id ... ...

Re: [OT] Re: Javascript problem

2008-02-11 Thread Pablo Vázquez Blázquez
Hi Jeromy, Thanks for your explanation. Now, my problem has a reason. Well, you say The S2 implementation executes the scripts at the end of parsing, not as each script tag is encountered. At the end of parsing is before inserting html into the DOM, isn´t it? So, if it is so, that's my