@Steve: I have also just done a small test:
http://paste.mootools.net/f49801ffb and the code alerts a value of "3" from the "var test" variable, so I'm not sure if your point was right. Michal. On Dec 17, 3:15 pm, Michal <[email protected]> wrote: > @Steve: > > I agree that there shouldn't be a "var mainMenu" in a function scope > if it is to be used elsewhere. However, I've had a quick search, and > from what I've found if you "var" something in global scope it becomes > global (and thus available in all other scopes, such as in a domready > function). Perhaps I am still confused... > > Michal. > > On Dec 17, 2:29 pm, stratboy <[email protected]> wrote: > > > Yes Michael, that's a solution I think. I was just trying a similar > > thing adding mainMenu as a window property and it worked: > > > window.addEvent('domready', function() { > > window.mainMenu = new Menu({ menuId:'menu', type:'bar', > > props:mainMenu }); > > > }); > > > anyway, probably your suggestion is more efficient, couse that way I > > don't touch the window object :) > > > Anyway, the thing that still remains quite strange to me, is that the > > first version I posted worked right in Safari and FF, and the problem > > is only with IE. Mmm... Maybe it's not a thing so strange.. > > > On 17 Dic, 15:22, Michal <[email protected]> wrote: > > > > Perhaps I've got the var thing a bit confused, but I would put > > > > var mainMenu; > > > > in the global scope, and then all later references to mainMenu should > > > refer to that. > > > > Michal. > > > > On Dec 17, 2:12 pm, "Steve Onnis" <[email protected]> wrote: > > > > > silly question.... > > > > > which file is being included first? > > > > > -----Original Message----- > > > > From: [email protected] > > > > > [mailto:[email protected]] On Behalf Of stratboy > > > > Sent: Thursday, 18 December 2008 1:11 AM > > > > To: MooTools Users > > > > Subject: IE(6) and variables in domready > > > > > Hi! I've got a little problem with domready in ie6: > > > > > window.addEvent('domready', function() { > > > > //no var key, so mainMenu should be global > > > > mainMenu = new Menu({ menuId:'menu', type:'bar', > > > > props:mainMenu }); > > > > }); > > > > > later, in another .js, file > > > > > window.addEvent('domready', function() { > > > > mainMenu.setStartButton({ mainIndex:6, subIndex:6, > > > > openSub:true }); > > > > }); > > > > > Safari and Firefox are just happy, but IE6 (don't know IE7) says that > > > > mainMenu is not defined. > > > > > This seems to be a mootools 1.2.1 issue, since in another site using > > > > 1.2.0, the same classes with the same methods work fine in IE6. > > > > > Any idea? Is that maybe the two domready don't execute in sequence? > > > > > If can be of help, I can post links to pages. > > > > > Bye!
