Hi Ty, As far as I understand, the onload handler (which is what the _IG_RegisterOnloadHandler() should be using as far as I understand) is executed only after the global scope Javascript has been executed. Therefore, this problem should not happen.
I am using global variables initialized in the global scope for easy to modify settings, just as you have shown in your example here, and I have not faced production issues. It would be interesting to hear from others as well on this. Is there a Javascript expert who could provide some feedback how this should work, per spec? Jerome On Nov 16, 6:20 pm, ty <[EMAIL PROTECTED]> wrote: > Hello, > > I have constants I'm loading globally. They are image URLs I use > frequently. > I am then using these constants in a function called by > _IG_RegisterOnloadHandler. > I notice that Firebug sometimes reports that my constants are not > defined. > > Is _IG_RegisterOnloadHandler getting called before the constants are > instantiated. Is this possible? If so, how can I prevent this? Here is > a simplified example: > > var url = "http://blah.com/"; > > function drawImage(ele, pic) { > _gel(ele).innerHTML = '<img src="' + url + pic + '"/>'; > // reports "url is undefined" > > } > > _IG_RegisterOnloadHandler(function() { > drawImage("pic1.gif"); > > }); > > Thanks, > Ty --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "iGoogle Developer Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Gadgets-API?hl=en -~----------~----~----~----~------~----~------~--~---
