I agree as well. As far as I know, the js evaluator is top-down, so vars initialized in the global scope above the _IG_RegisterOnloadHandler would already be set.
I wonder if is just Firebug being a jackass. I've encountered weird behavior before. Besides the warnings, the code seems to work perfectly. Just want to be vigilant. Thanks On Nov 17, 6:01 pm, "Jerome (Guru)" <[EMAIL PROTECTED]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---
