You need to define the variable.
http://mooshell.net/u/oskar/V924A/8/
On 5 Dec 2009, at 13:12, Steve Onnis wrote:
> I am having a little trouble with something i am working on which for some
> reason works in FireFox but not in IE
>
> Is there a squence on which the addEvent actions are run on the window
> object?
>
> Take the following Class for example
>
> var MooFormValidator = new Class({
> Implements : [Events, Options],
> options : {},
> initialize : function (element, options) {},
> boo : function () {alert("hello");}
> });
>
>
> // This errors in IE saying that "formValidator" is undefined
> // http://mooshell.net/V924A/6/
> window.addEvent("load", function () {
> formValidator = new MooFormValidator(new Element("div"), {});
> });
> window.addEvent("load", function() {
> formValidator.boo()
> });
>
> // Where as the following works fine
> http://mooshell.net/V924A/7/
> window.addEvent("load", function () {
> formValidator = new MooFormValidator(new Element("div"), {});
> formValidator.boo()
> });
>
>
> Anyone explain to me why this is happening? And how I can overcome it?
>
> Steve
>