Re: Basic Question
- From: "levinsontodd@xxxxxxxxx" <levinsontodd@xxxxxxxxx>
- Date: Sat, 24 May 2008 19:58:46 -0700 (PDT)
On May 24, 1:08 am, Gregor Kofler <use...@xxxxxxxxxxxxxxx> wrote:
levinsont...@xxxxxxxxx meinte:
test = {}
test.hi = alert("hi");
hi gets the "result" of (window.)alert assigned. And before returning
this result the alert is being popped up. What you were supposedly
looking for is
test.hi = function() { alert("hi"); };
However in your onload listener this.hi won't do the trick (just like
now). It must be test.hi()
Gregor
--http://photo.gregorkofler.at::: Landschafts- und Reisefotografiehttp://web.gregorkofler.com ::: meine JS-Spielwiesehttp://www.image2d.com ::: Bildagentur für den alpinen Raum
Hi Gregor,
Thanks for your answer.
So, instead of assigning a function to test.hi that popped up an
alert, I was actually assigning window.alert to test.hi?
I guess I still don't understand why the interpreter executed test.hi
first.
.
- Follow-Ups:
- Re: Basic Question
- From: david.karr
- Re: Basic Question
- References:
- Basic Question
- From: levinsontodd@xxxxxxxxx
- Re: Basic Question
- From: Gregor Kofler
- Basic Question
- Prev by Date: msie 6, 7 fails to pass form field value to function, how fix?
- Next by Date: Re: Basic Question
- Previous by thread: Re: Basic Question
- Next by thread: Re: Basic Question
- Index(es):
Relevant Pages
|