On 26-May-06, at 4:56 PM, Jay Parlar wrote:

> I'm just starting to learn MochiKit (actually, I'm just starting to
> learn JavaScript as well), but I'm a long time Python guy, so I  
> felt it
> would be a good fit.
>
> Anyway, I'm trying to do a very simple 'connect', and I'm seeing some
> strange behaviour.
>
> I have the following in my script:
>
> connect('tester', 'onclick', requestTags);
>
>
> where 'tester' is the id of a link on the page, and requestTags is a
> very simple function. If this is the only connect call I have, then
> nothing happens when I click on the link. However, if I do this
> instead:
>
>     var con = function() {
>         connect('tester', 'onclick', requestTags);
>     }
>     connect(window, 'onload', con);
>
> then everything works perfectly.
>
> Why is it that I first have to do a connection with the window? The
> documents don't seem to mention anything about that (and I only got  
> the
> idea from another post on this group).
>
> Thanks in advance, and sorry if this is a really stupid question,
> Jay P.

Hi Jay,

The reason you need to do this is the JavaScript in the <head> is  
being executed before the rest of the page -- including your 'tester'  
-- is loaded.

Beau

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---

Reply via email to