Hi there,
You could do
var s = SPAN('test');
s.onclick = bind(do_something,s);
However, to make you life easier when dealing with JS events and
different event models in different browsers, check out the Signal
module in Mochikit [1]. Among other things, it allows you to connect
multiple handlers to a single event (doing an s.onclick = whatever
replaces the previous event handler). That said, the "mochikit way"
would be:
var s = SPAN('test');
connect(s, do_somehting);
Arnar
[1] http://www.mochikit.com/doc/html/MochiKit/Signal.html
X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.54.68.11 with SMTP id q11mr174682wra;
Sun, 21 May 2006 12:55:18 -0700 (PDT)
Return-Path: <[EMAIL PROTECTED]>
Received: from nz-out-0102.google.com ([64.233.162.206])
by mx.googlegroups.com with ESMTP id v11si739962cwb.2006.05.21.12.55.18;
Sun, 21 May 2006 12:55:18 -0700 (PDT)
Received-SPF: pass (googlegroups.com: domain of [EMAIL PROTECTED] designates
64.233.162.206 as permitted sender)
DomainKey-Status: good (test mode)
Received: by nz-out-0102.google.com with SMTP id 4so1112175nzn
for <[email protected]>; Sun, 21 May 2006 12:55:17 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
s¾ta; d=gmail.com;
h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
b=jMz4WJw0UHEyRRQ87RlLK5j90XgwNN6pymDqty8tFr0SNN8zC/d2WZDh2pB7dp2wjEmSFj2kesPLDY+8a/2GheNf/jyXyQo5RW5ktXymMAYlm8MeSdsZJZ8SvSctFu6ei0IjuFI76KSgLfxQkWZ9Hj4rd0fibKnyvr1HFJ/YKqMReceived:
by 10.36.19.13 with SMTP id 13mr3250363nzs;
Sun, 21 May 2006 12:55:17 -0700 (PDT)
Received: by 10.36.157.18 with HTTP; Sun, 21 May 2006 12:55:17 -0700 (PDT)
Message-ID: <[EMAIL PROTECTED]>
Date: Sun, 21 May 2006 19:55:17 +0000
From: "Arnar Birgisson" <[EMAIL PROTECTED]>
To: [email protected]
Subject: Re: [mochikit] onclick question
In-Reply-To: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
References: <[EMAIL PROTECTED]>
Hi there,
You could do
var s = SPAN('test');
s.onclick = bind(do_something,s);
However, to make you life easier when dealing with JS events and
different event models in different browsers, check out the Signal
module in Mochikit [1]. Among other things, it allows you to connect
multiple handlers to a single event (doing an s.onclick = whatever
replaces the previous event handler). That said, the "mochikit way"
would be:
var s = SPAN('test');
connect(s, do_somehting);
Arnar
[1] http://www.mochikit.com/doc/html/MochiKit/Signal.html
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---