• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

Call Function

mscholz

Neues Mitglied
Hallo,
I want to call myFun() from another function the problem is following construct:
When I try it with myFun() I jsut get error:
Cannot read property 'myFun' of undefined
Can someone help me with this Problem?
Greetings

HTML:
(function() {
function myFun() {
}
})();
 
Hallo,
I want to call myFun() from another function the problem is following construct:
When I try it with myFun() I jsut get error:
Cannot read property 'myFun' of undefined
Can someone help me with this Problem?
Greetings

HTML:
(function() {
function myFun() {
}
})();

Hello,

I don't know wie manche immer wieder auf den idea kommen hier englisch zu writen…

Code:
(function(window) {
window.myFun = function () {
}
})(window);

function anotherFunction () {
  myFun();
}
 
Zurück
Oben