0

I've created a tabview by this way:

var tabview;
var Y = YUI({ insertBefore: 'my_css' });
Y.use('tabview', function (Y) {
    tabview = new Y.TabView({
    children: [{
        label: 'Suche',
        content: "<div id=\"tab1\"> </div>"
    }, {
        label: 'Objekt-Liste',
        content: "<div id=\"tab2\"> </div>"
    }, {
        label: 'Objekt-Detail',
        content: "<div id=\"tab3\"> </div>"
    }]
});

tabview.item(1).disable().on('selectedChange', function () {
    if (boolTab1) {
        return true;
    } else {
        return false;
    }
});

tabview.item(2).disable().on('selectedChange', function () {
    if (boolTab2) {
        return true;
    } else {
        return false;
    }
});
tabview.render('#tabs');
});

Now I'd like to access my tabview object from outside. E.g. on load this function is called:

function init() {

tabview.deselectAll();
tabview.selectChild(0);
this.name = "";
this.value = "";
boolTab1 = false;
boolTab2 = false;
tabview.item(1).disable();
tabview.item(2).disable();
requestSuche(this);
}

So, this works with FF flawless. However, all other browsers I've tested do not know about a tabview object in the init() function. Interesting point; in firefox it also works when I remove the 'var tabview' on top. How can I access correctly my tabview from my other js functions?

Chris
  • 234
  • 1
  • 11

1 Answers1

0

Ok, the problem was that the init() function is the onload function of the body which has been called before my tabview was created. Moving the init() function into my tabview codeblock solved the problem.

Chris
  • 234
  • 1
  • 11