@Michal, please excuse me, I was doing a stupid error, so now I can
confirm that in fact I CAN also use a global variable without
attaching it directly to Window, like this:

var mainMenu = null;

 window.addEvent('domready', function() {
        mainMenu = new Menu({ menuId:'menu', type:'bar',
props:mainMenu });
});

I can then use  mainMenu in any following .js file.
var mainMenu and window.mainMenu do work.

--------

ANYWAY, till now no one could tell me why it seems I MUST set up a
global variable OUTSIDE the domready event to see and use it in
following domready calls in IE6.
And why this didn't happen with mootools 1.2.0. These 2 were the
original questions.

-------

For the var/non var issues, I think that both Nutron and Steve gave
good explanation.
I think that the thing to keep in mind is that 'var' doesn't
necessarily mean 'local' or 'global'.

A little scheme:

DECLARATION OUTSIDE A FUNCTION
    - with var: GLOBAL
    - without var: GLOBAL

DECLARATION INSIDE A FUNCTION
    - with var: LOCAL
    - without var: GLOBAL

There may also be some issue realtive to vars declared in different
script tags, but I don't know, and basically don't mind. :P

-------

Bye!





Reply via email to