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 not necessarily execute the scripts (it's browser-dependent)

The S2 implementation executes the scripts at the end of parsing, not as each script tag is encountered. Your design needs to cater for this. As others mentioned, addOnLoad is okay for a full page, but if you're using XHR then you'll need to use dojo's pub/sub features.

Pablo Vázquez Blázquez wrote:
Hi!

Anyone knows why my javascript code is executed at the loading of a page instead when it *should*??

For example, I have a .jspx page with a form:

<form>
   ...
   <input id="id" ...>
   ...
<form>

<script>
   alert('hi');
   alert(document.getElementById('id'));
</script>


'hi' is shown before the form and then 'undefined'.
But my js code is at the end of the page. How can it be possible? I´m sure it is a dojo thing, but I don´t know how to solve it. I access to this page from another one where I have executeScripts="true".

Thanks.


---------------------------------------------------------------------
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]

Reply via email to