Re: Basic Question



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.
.



Relevant Pages

  • Re: Basic Question
    ... this result the alert is being popped up. ... I was actually assigning window.alert to test.hi? ... of calling that function to the variable "test.hi". ... only would have executed on completion of window load. ...
    (comp.lang.javascript)
  • Re: Activate TaskBar Browser From Application
    ... assigning actions to various users of my system. ... explorer taskbar flash if tfey have a new action assigned. ... That's the closest I can think of in terms of attracting the user's attention if his browser window is minimized. ... there is even a sound when the alert pops up. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Basic Question
    ... this result the alert is being popped up. ... and then assigning the result ... of calling that function to the variable "test.hi". ... only would have executed on completion of window load. ...
    (comp.lang.javascript)
  • Re: Basic Question
    ... levinsontodd@xxxxxxxxx meinte: ... this result the alert is being popped up. ... However in your onload listener this.hi won't do the trick. ...
    (comp.lang.javascript)
  • Re: Help with sscanf()
    ... your trick of scanning into an ... >>intermediate variable and assigning to the array need not ...
    (comp.lang.c)