I''m trying to call a click() event on an <a href> that has an
Observable registered for it. Something like:
<a href="#" id="toggle_1929">show</a>
...
Event.observe("toggle_1929", ''click'',
function(event){ Element.toggle
("group_1929"); return false; });
...
$("toggle_1929").click(); //this throws "Error: $
("toggle_1929").click is not a function"
Thanks,
Jamie
Try using onclick().
Jon Whitcraft
Web Application Developer
Online Services - Indianapolis Motor Speedway
(317) 492-8623
-----Original Message-----
From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
On Behalf Of Jamie
Orchard-Hays
Sent: Monday, October 17, 2005 2:32 PM
To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: [Rails-spinoffs] a better question
I''m trying to call a click() event on an <a href> that has an
Observable registered for it. Something like:
<a href="#" id="toggle_1929">show</a>
...
Event.observe("toggle_1929", ''click'',
function(event){ Element.toggle
("group_1929"); return false; });
...
$("toggle_1929").click(); //this throws "Error: $
("toggle_1929").click is not a function"
Thanks,
Jamie
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
********************
********************
This E-mail (and attachments) may contain confidential/privileged information
intended only for the named addressee(s). If you are not an intended recipient,
do not read, copy, disseminate or take any action based on the content of this
E-mail. Please notify the sender by reply E-mail and erase this E-mail from your
system. Your assistance is appreciated. E-mail transmission may not be secure or
error-free. The company is not responsible for any loss/damage arising from any
virus transmitted.
********************
********************
onClick is the event listener I''m trying to trigger. Jamie On Oct 17, 2005, at 3:53 PM, Whitcraft, Jon wrote:> Try using onclick(). > > Jon Whitcraft > Web Application Developer > Online Services - Indianapolis Motor Speedway > (317) 492-8623 > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of > Jamie > Orchard-Hays > Sent: Monday, October 17, 2005 2:32 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: [Rails-spinoffs] a better question > > I''m trying to call a click() event on an <a href> that has an > Observable registered for it. Something like: > > <a href="#" id="toggle_1929">show</a> > ... > > Event.observe("toggle_1929", ''click'', function(event){ Element.toggle > ("group_1929"); return false; }); > ... > > $("toggle_1929").click(); //this throws "Error: $ > ("toggle_1929").click is not a function" > > Thanks, > > Jamie > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > ******************** > ******************** > This E-mail (and attachments) may contain confidential/privileged > information intended only for the named addressee(s). If you are > not an intended recipient, do not read, copy, disseminate or take > any action based on the content of this E-mail. Please notify the > sender by reply E-mail and erase this E-mail from your system. Your > assistance is appreciated. E-mail transmission may not be secure or > error-free. The company is not responsible for any loss/damage > arising from any virus transmitted. > ******************** > ******************** > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
It''s also the name of the function you need to call ;) --- Jamie Orchard-Hays <jamie-fswG1Ka7Iew@public.gmane.org> wrote:> onClick is the event listener I''m trying to trigger. > > Jamie > > > On Oct 17, 2005, at 3:53 PM, Whitcraft, Jon wrote: > > > Try using onclick(). > > > > Jon Whitcraft > > Web Application Developer > > Online Services - Indianapolis Motor Speedway > > (317) 492-8623 > > > > -----Original Message----- > > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > >[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]> On Behalf Of > > Jamie > > Orchard-Hays > > Sent: Monday, October 17, 2005 2:32 PM > > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > Subject: [Rails-spinoffs] a better question > > > > I''m trying to call a click() event on an <a href> > that has an > > Observable registered for it. Something like: > > > > <a href="#" id="toggle_1929">show</a> > > ... > > > > Event.observe("toggle_1929", ''click'', > function(event){ Element.toggle > > ("group_1929"); return false; }); > > ... > > > > $("toggle_1929").click(); //this throws "Error: $ > > ("toggle_1929").click is not a function" > > > > Thanks, > > > > Jamie > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > >http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs> > ******************** > > ******************** > > This E-mail (and attachments) may contain > confidential/privileged > > information intended only for the named > addressee(s). If you are > > not an intended recipient, do not read, copy, > disseminate or take > > any action based on the content of this E-mail. > Please notify the > > sender by reply E-mail and erase this E-mail from > your system. Your > > assistance is appreciated. E-mail transmission may > not be secure or > > error-free. The company is not responsible for any > loss/damage > > arising from any virus transmitted. > > ******************** > > ******************** > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > >http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs> > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs>__________________________________ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/
I haven''t found onClick() defined as a method anywhere in javascript docs or in scriptaculous. Can you point me to this? Jamie On Oct 17, 2005, at 5:07 PM, San Trois wrote:> It''s also the name of the function you need to call ;) > > --- Jamie Orchard-Hays <jamie-fswG1Ka7Iew@public.gmane.org> wrote: > > >> onClick is the event listener I''m trying to trigger. >> >> Jamie >> >> >> On Oct 17, 2005, at 3:53 PM, Whitcraft, Jon wrote: >> >> >>> Try using onclick(). >>> >>> Jon Whitcraft >>> Web Application Developer >>> Online Services - Indianapolis Motor Speedway >>> (317) 492-8623 >>> >>> -----Original Message----- >>> From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> >>> >> >> > [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] > >> On Behalf Of >> >>> Jamie >>> Orchard-Hays >>> Sent: Monday, October 17, 2005 2:32 PM >>> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> Subject: [Rails-spinoffs] a better question >>> >>> I''m trying to call a click() event on an <a href> >>> >> that has an >> >>> Observable registered for it. Something like: >>> >>> <a href="#" id="toggle_1929">show</a> >>> ... >>> >>> Event.observe("toggle_1929", ''click'', >>> >> function(event){ Element.toggle >> >>> ("group_1929"); return false; }); >>> ... >>> >>> $("toggle_1929").click(); //this throws "Error: $ >>> ("toggle_1929").click is not a function" >>> >>> Thanks, >>> >>> Jamie >>> _______________________________________________ >>> Rails-spinoffs mailing list >>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> >>> >> >> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > >>> ******************** >>> ******************** >>> This E-mail (and attachments) may contain >>> >> confidential/privileged >> >>> information intended only for the named >>> >> addressee(s). If you are >> >>> not an intended recipient, do not read, copy, >>> >> disseminate or take >> >>> any action based on the content of this E-mail. >>> >> Please notify the >> >>> sender by reply E-mail and erase this E-mail from >>> >> your system. Your >> >>> assistance is appreciated. E-mail transmission may >>> >> not be secure or >> >>> error-free. The company is not responsible for any >>> >> loss/damage >> >>> arising from any virus transmitted. >>> ******************** >>> ******************** >>> _______________________________________________ >>> Rails-spinoffs mailing list >>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> >>> >> >> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > >>> >>> >> >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> >> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > >> >> > > > > > __________________________________ > Yahoo! Music Unlimited > Access over 1 million songs. Try it free. > http://music.yahoo.com/unlimited/ > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
onclick() is what function the browsers call when you click on something. you
set it by using click and call it with onclick() becuase when you set it in a
html tag it''s like this:
<a href="javascript:void(0);"
onclick="alert(''hello'')">Click Here</a>
does that make sense?
Jon
________________________________
From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
on behalf of Jamie Orchard-Hays
Sent: Mon 10/17/2005 6:02 PM
To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: Re: [Rails-spinoffs] a better question
I haven''t found onClick() defined as a method anywhere in javascript
docs or in scriptaculous. Can you point me to this?
Jamie
On Oct 17, 2005, at 5:07 PM, San Trois wrote:
> It''s also the name of the function you need to call ;)
>
> --- Jamie Orchard-Hays <jamie-fswG1Ka7Iew@public.gmane.org> wrote:
>
>
>> onClick is the event listener I''m trying to trigger.
>>
>> Jamie
>>
>>
>> On Oct 17, 2005, at 3:53 PM, Whitcraft, Jon wrote:
>>
>>
>>> Try using onclick().
>>>
>>> Jon Whitcraft
>>> Web Application Developer
>>> Online Services - Indianapolis Motor Speedway
>>> (317) 492-8623
>>>
>>> -----Original Message-----
>>> From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>
>>>
>>
>>
>
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
>
>> On Behalf Of
>>
>>> Jamie
>>> Orchard-Hays
>>> Sent: Monday, October 17, 2005 2:32 PM
>>> To:
rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>> Subject: [Rails-spinoffs] a better question
>>>
>>> I''m trying to call a click() event on an <a href>
>>>
>> that has an
>>
>>> Observable registered for it. Something like:
>>>
>>> <a href="#"
id="toggle_1929">show</a>
>>> ...
>>>
>>> Event.observe("toggle_1929", ''click'',
>>>
>> function(event){ Element.toggle
>>
>>> ("group_1929"); return false; });
>>> ...
>>>
>>> $("toggle_1929").click(); //this throws "Error: $
>>> ("toggle_1929").click is not a function"
>>>
>>> Thanks,
>>>
>>> Jamie
>>> _______________________________________________
>>> Rails-spinoffs mailing list
>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>
>>>
>>
>>
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
>>> ********************
>>> ********************
>>> This E-mail (and attachments) may contain
>>>
>> confidential/privileged
>>
>>> information intended only for the named
>>>
>> addressee(s). If you are
>>
>>> not an intended recipient, do not read, copy,
>>>
>> disseminate or take
>>
>>> any action based on the content of this E-mail.
>>>
>> Please notify the
>>
>>> sender by reply E-mail and erase this E-mail from
>>>
>> your system. Your
>>
>>> assistance is appreciated. E-mail transmission may
>>>
>> not be secure or
>>
>>> error-free. The company is not responsible for any
>>>
>> loss/damage
>>
>>> arising from any virus transmitted.
>>> ********************
>>> ********************
>>> _______________________________________________
>>> Rails-spinoffs mailing list
>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>
>>>
>>
>>
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
>>>
>>>
>>
>> _______________________________________________
>> Rails-spinoffs mailing list
>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>
>>
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
>>
>>
>
>
>
>
> __________________________________
> Yahoo! Music Unlimited
> Access over 1 million songs. Try it free.
> http://music.yahoo.com/unlimited/
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
********************
********************
This E-mail (and attachments) may contain confidential/privileged information
intended only for the named addressee(s). If you are not an intended recipient,
do not read, copy, disseminate or take any action based on the content of this
E-mail. Please notify the sender by reply E-mail and erase this E-mail from your
system. Your assistance is appreciated. E-mail transmission may not be secure or
error-free. The company is not responsible for any loss/damage arising from any
virus transmitted.
********************
********************
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Doesn''t make sense to me at least ;-) If i click the link you show
below, the browser is going to execute the Javascript expression
"alert(''hello'')"; there''s no onclick()
function involved. In Jamie''s
case, the function that gets called is the anonymous function he
passes to Event.observe().
Jamie, I think what you need to do (and maybe this is what Jon''s
getting at) is to invoke the function that''s bound to the
''onclick''
property of the element you''re interested in. This should do the trick:
$(''toggle_1929'').onclick();
So you were pretty close :-)
L.
On 17-Oct-05, at 9:16 PM, Whitcraft, Jon wrote:
> onclick() is what function the browsers call when you click on
> something. you set it by using click and call it with onclick()
> becuase when you set it in a html tag it''s like this:
>
> <a href="javascript:void(0);"
onclick="alert(''hello'')">Click Here</a>
>
> does that make sense?
>
> Jon
>
> ________________________________
>
> From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org on
behalf of
> Jamie Orchard-Hays
> Sent: Mon 10/17/2005 6:02 PM
> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> Subject: Re: [Rails-spinoffs] a better question
>
>
>
> I haven''t found onClick() defined as a method anywhere in
javascript
> docs or in scriptaculous. Can you point me to this?
>
> Jamie
>
>
> On Oct 17, 2005, at 5:07 PM, San Trois wrote:
>
>
>> It''s also the name of the function you need to call ;)
>>
>> --- Jamie Orchard-Hays <jamie-fswG1Ka7Iew@public.gmane.org>
wrote:
>>
>>
>>
>>> onClick is the event listener I''m trying to trigger.
>>>
>>> Jamie
>>>
>>>
>>> On Oct 17, 2005, at 3:53 PM, Whitcraft, Jon wrote:
>>>
>>>
>>>
>>>> Try using onclick().
>>>>
>>>> Jon Whitcraft
>>>> Web Application Developer
>>>> Online Services - Indianapolis Motor Speedway
>>>> (317) 492-8623
>>>>
>>>> -----Original Message-----
>>>> From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
>>
>>
>>> On Behalf Of
>>>
>>>
>>>> Jamie
>>>> Orchard-Hays
>>>> Sent: Monday, October 17, 2005 2:32 PM
>>>> To:
rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>> Subject: [Rails-spinoffs] a better question
>>>>
>>>> I''m trying to call a click() event on an <a
href>
>>>>
>>>>
>>> that has an
>>>
>>>
>>>> Observable registered for it. Something like:
>>>>
>>>> <a href="#"
id="toggle_1929">show</a>
>>>> ...
>>>>
>>>> Event.observe("toggle_1929",
''click'',
>>>>
>>>>
>>> function(event){ Element.toggle
>>>
>>>
>>>> ("group_1929"); return false; });
>>>> ...
>>>>
>>>> $("toggle_1929").click(); //this throws "Error:
$
>>>> ("toggle_1929").click is not a function"
>>>>
>>>> Thanks,
>>>>
>>>> Jamie
>>>> _______________________________________________
>>>> Rails-spinoffs mailing list
>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>
>>>>
>>>>
>>>
>>>
>>>
>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>
>>
>>>> ********************
>>>> ********************
>>>> This E-mail (and attachments) may contain
>>>>
>>>>
>>> confidential/privileged
>>>
>>>
>>>> information intended only for the named
>>>>
>>>>
>>> addressee(s). If you are
>>>
>>>
>>>> not an intended recipient, do not read, copy,
>>>>
>>>>
>>> disseminate or take
>>>
>>>
>>>> any action based on the content of this E-mail.
>>>>
>>>>
>>> Please notify the
>>>
>>>
>>>> sender by reply E-mail and erase this E-mail from
>>>>
>>>>
>>> your system. Your
>>>
>>>
>>>> assistance is appreciated. E-mail transmission may
>>>>
>>>>
>>> not be secure or
>>>
>>>
>>>> error-free. The company is not responsible for any
>>>>
>>>>
>>> loss/damage
>>>
>>>
>>>> arising from any virus transmitted.
>>>> ********************
>>>> ********************
>>>> _______________________________________________
>>>> Rails-spinoffs mailing list
>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>
>>>>
>>>>
>>>
>>>
>>>
>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>
>>
>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Rails-spinoffs mailing list
>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>
>>>
>>>
>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>
>>
>>>
>>>
>>>
>>
>>
>>
>>
>> __________________________________
>> Yahoo! Music Unlimited
>> Access over 1 million songs. Try it free.
>> http://music.yahoo.com/unlimited/
>> _______________________________________________
>> Rails-spinoffs mailing list
>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>
>>
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> ********************
> ********************
> This E-mail (and attachments) may contain confidential/privileged
> information intended only for the named addressee(s). If you are
> not an intended recipient, do not read, copy, disseminate or take
> any action based on the content of this E-mail. Please notify the
> sender by reply E-mail and erase this E-mail from your system. Your
> assistance is appreciated. E-mail transmission may not be secure or
> error-free. The company is not responsible for any loss/damage
> arising from any virus transmitted.
> ********************
> ********************
>
> <winmail.dat>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
--
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/
Thanks, both of you. I''ll try this when I get back to work tomorrow.
One thing I wonder about, I found a site that talks about the onclick
() method. It mentions that the event is not passed as an argument.
The observer and my code in the observer registration rely on this,
so I suspect that it won''t work (the "$group.id" references
are
server-side variables):
Event.observe("toggle_$group.id", ''click'',
function(event)
{ Element.toggle("group_$group.id");
Event.element(event).innerHTML =
(Event.element(event).innerHTML == ''hide'' ?
''show'' : ''hide'');
Sortable.create("group_$group.id",
{ghosting:true,constraint:false,
onUpdate:function(sortable)
{window.location = "ReorderWebCategory.action?groupIdsKey=group_$
{group.id}&" + Sortable.serialize(sortable) +
"&toggleLevel=" +
toggleLevel + "#$group.id";
new Effect.Pulsate(sortable);},
onChange:function(sortable){$
(sortable.style.backgroundColor = "#ffff00");}
});
return false; });
Here''s the site I found:
http://www.quirksmode.org/js/
Jamie
On Oct 17, 2005, at 11:24 PM, Laurie Harper wrote:
> Doesn''t make sense to me at least ;-) If i click the link you show
> below, the browser is going to execute the Javascript expression
> "alert(''hello'')"; there''s no onclick()
function involved. In
> Jamie''s case, the function that gets called is the anonymous
> function he passes to Event.observe().
>
> Jamie, I think what you need to do (and maybe this is what Jon''s
> getting at) is to invoke the function that''s bound to the
''onclick''
> property of the element you''re interested in. This should do the
> trick:
>
> $(''toggle_1929'').onclick();
>
> So you were pretty close :-)
>
> L.
>
> On 17-Oct-05, at 9:16 PM, Whitcraft, Jon wrote:
>
>
>> onclick() is what function the browsers call when you click on
>> something. you set it by using click and call it with onclick()
>> becuase when you set it in a html tag it''s like this:
>>
>> <a href="javascript:void(0);"
onclick="alert(''hello'')">Click Here</a>
>>
>> does that make sense?
>>
>> Jon
>>
>> ________________________________
>>
>> From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org on
behalf of
>> Jamie Orchard-Hays
>> Sent: Mon 10/17/2005 6:02 PM
>> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> Subject: Re: [Rails-spinoffs] a better question
>>
>>
>>
>> I haven''t found onClick() defined as a method anywhere in
javascript
>> docs or in scriptaculous. Can you point me to this?
>>
>> Jamie
>>
>>
>> On Oct 17, 2005, at 5:07 PM, San Trois wrote:
>>
>>
>>
>>> It''s also the name of the function you need to call ;)
>>>
>>> --- Jamie Orchard-Hays <jamie-fswG1Ka7Iew@public.gmane.org>
wrote:
>>>
>>>
>>>
>>>
>>>> onClick is the event listener I''m trying to trigger.
>>>>
>>>> Jamie
>>>>
>>>>
>>>> On Oct 17, 2005, at 3:53 PM, Whitcraft, Jon wrote:
>>>>
>>>>
>>>>
>>>>
>>>>> Try using onclick().
>>>>>
>>>>> Jon Whitcraft
>>>>> Web Application Developer
>>>>> Online Services - Indianapolis Motor Speedway
>>>>> (317) 492-8623
>>>>>
>>>>> -----Original Message-----
>>>>> From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
>>>
>>>
>>>
>>>> On Behalf Of
>>>>
>>>>
>>>>
>>>>> Jamie
>>>>> Orchard-Hays
>>>>> Sent: Monday, October 17, 2005 2:32 PM
>>>>> To:
rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>> Subject: [Rails-spinoffs] a better question
>>>>>
>>>>> I''m trying to call a click() event on an <a
href>
>>>>>
>>>>>
>>>>>
>>>> that has an
>>>>
>>>>
>>>>
>>>>> Observable registered for it. Something like:
>>>>>
>>>>> <a href="#"
id="toggle_1929">show</a>
>>>>> ...
>>>>>
>>>>> Event.observe("toggle_1929",
''click'',
>>>>>
>>>>>
>>>>>
>>>> function(event){ Element.toggle
>>>>
>>>>
>>>>
>>>>> ("group_1929"); return false; });
>>>>> ...
>>>>>
>>>>> $("toggle_1929").click(); //this throws
"Error: $
>>>>> ("toggle_1929").click is not a function"
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Jamie
>>>>> _______________________________________________
>>>>> Rails-spinoffs mailing list
>>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>
>>>
>>>
>>>>> ********************
>>>>> ********************
>>>>> This E-mail (and attachments) may contain
>>>>>
>>>>>
>>>>>
>>>> confidential/privileged
>>>>
>>>>
>>>>
>>>>> information intended only for the named
>>>>>
>>>>>
>>>>>
>>>> addressee(s). If you are
>>>>
>>>>
>>>>
>>>>> not an intended recipient, do not read, copy,
>>>>>
>>>>>
>>>>>
>>>> disseminate or take
>>>>
>>>>
>>>>
>>>>> any action based on the content of this E-mail.
>>>>>
>>>>>
>>>>>
>>>> Please notify the
>>>>
>>>>
>>>>
>>>>> sender by reply E-mail and erase this E-mail from
>>>>>
>>>>>
>>>>>
>>>> your system. Your
>>>>
>>>>
>>>>
>>>>> assistance is appreciated. E-mail transmission may
>>>>>
>>>>>
>>>>>
>>>> not be secure or
>>>>
>>>>
>>>>
>>>>> error-free. The company is not responsible for any
>>>>>
>>>>>
>>>>>
>>>> loss/damage
>>>>
>>>>
>>>>
>>>>> arising from any virus transmitted.
>>>>> ********************
>>>>> ********************
>>>>> _______________________________________________
>>>>> Rails-spinoffs mailing list
>>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>
>>>
>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Rails-spinoffs mailing list
>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>
>>>>
>>>>
>>>>
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>
>>>
>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>> __________________________________
>>> Yahoo! Music Unlimited
>>> Access over 1 million songs. Try it free.
>>> http://music.yahoo.com/unlimited/
>>> _______________________________________________
>>> Rails-spinoffs mailing list
>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>
>>>
>>>
>>
>> _______________________________________________
>> Rails-spinoffs mailing list
>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>> ********************
>> ********************
>> This E-mail (and attachments) may contain confidential/privileged
>> information intended only for the named addressee(s). If you are
>> not an intended recipient, do not read, copy, disseminate or take
>> any action based on the content of this E-mail. Please notify the
>> sender by reply E-mail and erase this E-mail from your system.
>> Your assistance is appreciated. E-mail transmission may not be
>> secure or error-free. The company is not responsible for any loss/
>> damage arising from any virus transmitted.
>> ********************
>> ********************
>>
>> <winmail.dat>
>> _______________________________________________
>> Rails-spinoffs mailing list
>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>
>>
>
> --
> Laurie Harper
> Open Source advocate, Java geek: http://www.holoweb.net/laurie
> Founder, Zotech Software: http://www.zotechsoftware.com/
>
>
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
So I tried the "onclick()" suggestion and an error was thrown that
reported:
Error: $("toggle_1901").onclick is not a function
window.onload($("toggle_1901").onclick());
is the code and there is an <a href></a> that has
"toggle_1901" as
the id.
Have you guys tried to trigger an even this way before?
Jamie
On Oct 17, 2005, at 11:38 PM, Jamie Orchard-Hays wrote:
> Thanks, both of you. I''ll try this when I get back to work
> tomorrow. One thing I wonder about, I found a site that talks about
> the onclick() method. It mentions that the event is not passed as
> an argument. The observer and my code in the observer registration
> rely on this, so I suspect that it won''t work (the
"$group.id"
> references are server-side variables):
>
> Event.observe("toggle_$group.id", ''click'',
function(event)
> { Element.toggle("group_$group.id");
> Event.element(event).innerHTML =
> (Event.element(event).innerHTML == ''hide'' ?
''show'' : ''hide'');
> Sortable.create("group_$group.id",
> {ghosting:true,constraint:false,
> onUpdate:function(sortable)
> {window.location = "ReorderWebCategory.action?groupIdsKey=group_$
> {group.id}&" + Sortable.serialize(sortable) +
"&toggleLevel=" +
> toggleLevel + "#$group.id";
> new Effect.Pulsate(sortable);},
> onChange:function(sortable){$
> (sortable.style.backgroundColor = "#ffff00");}
> });
> return false; });
>
> Here''s the site I found:
>
> http://www.quirksmode.org/js/
>
> Jamie
>
>
>
> On Oct 17, 2005, at 11:24 PM, Laurie Harper wrote:
>
>
>> Doesn''t make sense to me at least ;-) If i click the link you
show
>> below, the browser is going to execute the Javascript expression
>> "alert(''hello'')"; there''s no
onclick() function involved. In
>> Jamie''s case, the function that gets called is the anonymous
>> function he passes to Event.observe().
>>
>> Jamie, I think what you need to do (and maybe this is what
Jon''s
>> getting at) is to invoke the function that''s bound to the
>> ''onclick'' property of the element you''re
interested in. This
>> should do the trick:
>>
>> $(''toggle_1929'').onclick();
>>
>> So you were pretty close :-)
>>
>> L.
>>
>> On 17-Oct-05, at 9:16 PM, Whitcraft, Jon wrote:
>>
>>
>>
>>> onclick() is what function the browsers call when you click on
>>> something. you set it by using click and call it with onclick()
>>> becuase when you set it in a html tag it''s like this:
>>>
>>> <a href="javascript:void(0);"
onclick="alert(''hello'')">Click
>>> Here</a>
>>>
>>> does that make sense?
>>>
>>> Jon
>>>
>>> ________________________________
>>>
>>> From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org on
behalf of
>>> Jamie Orchard-Hays
>>> Sent: Mon 10/17/2005 6:02 PM
>>> To:
rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>> Subject: Re: [Rails-spinoffs] a better question
>>>
>>>
>>>
>>> I haven''t found onClick() defined as a method anywhere in
javascript
>>> docs or in scriptaculous. Can you point me to this?
>>>
>>> Jamie
>>>
>>>
>>> On Oct 17, 2005, at 5:07 PM, San Trois wrote:
>>>
>>>
>>>
>>>
>>>> It''s also the name of the function you need to call ;)
>>>>
>>>> --- Jamie Orchard-Hays
<jamie-fswG1Ka7Iew@public.gmane.org> wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> onClick is the event listener I''m trying to
trigger.
>>>>>
>>>>> Jamie
>>>>>
>>>>>
>>>>> On Oct 17, 2005, at 3:53 PM, Whitcraft, Jon wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Try using onclick().
>>>>>>
>>>>>> Jon Whitcraft
>>>>>> Web Application Developer
>>>>>> Online Services - Indianapolis Motor Speedway
>>>>>> (317) 492-8623
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
>>>>
>>>>
>>>>
>>>>
>>>>> On Behalf Of
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Jamie
>>>>>> Orchard-Hays
>>>>>> Sent: Monday, October 17, 2005 2:32 PM
>>>>>> To:
rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>> Subject: [Rails-spinoffs] a better question
>>>>>>
>>>>>> I''m trying to call a click() event on an <a
href>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> that has an
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Observable registered for it. Something like:
>>>>>>
>>>>>> <a href="#"
id="toggle_1929">show</a>
>>>>>> ...
>>>>>>
>>>>>> Event.observe("toggle_1929",
''click'',
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> function(event){ Element.toggle
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> ("group_1929"); return false; });
>>>>>> ...
>>>>>>
>>>>>> $("toggle_1929").click(); //this throws
"Error: $
>>>>>> ("toggle_1929").click is not a function"
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Jamie
>>>>>> _______________________________________________
>>>>>> Rails-spinoffs mailing list
>>>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>>
>>>>
>>>>
>>>>
>>>>>> ********************
>>>>>> ********************
>>>>>> This E-mail (and attachments) may contain
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> confidential/privileged
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> information intended only for the named
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> addressee(s). If you are
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> not an intended recipient, do not read, copy,
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> disseminate or take
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> any action based on the content of this E-mail.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> Please notify the
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> sender by reply E-mail and erase this E-mail from
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> your system. Your
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> assistance is appreciated. E-mail transmission may
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> not be secure or
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> error-free. The company is not responsible for any
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> loss/damage
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> arising from any virus transmitted.
>>>>>> ********************
>>>>>> ********************
>>>>>> _______________________________________________
>>>>>> Rails-spinoffs mailing list
>>>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>>
>>>>
>>>>
>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Rails-spinoffs mailing list
>>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>>
>>>>
>>>>
>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>> __________________________________
>>>> Yahoo! Music Unlimited
>>>> Access over 1 million songs. Try it free.
>>>> http://music.yahoo.com/unlimited/
>>>> _______________________________________________
>>>> Rails-spinoffs mailing list
>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>>
>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Rails-spinoffs mailing list
>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>> ********************
>>> ********************
>>> This E-mail (and attachments) may contain confidential/privileged
>>> information intended only for the named addressee(s). If you are
>>> not an intended recipient, do not read, copy, disseminate or take
>>> any action based on the content of this E-mail. Please notify the
>>> sender by reply E-mail and erase this E-mail from your system.
>>> Your assistance is appreciated. E-mail transmission may not be
>>> secure or error-free. The company is not responsible for any loss/
>>> damage arising from any virus transmitted.
>>> ********************
>>> ********************
>>>
>>> <winmail.dat>
>>> _______________________________________________
>>> Rails-spinoffs mailing list
>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>
>>>
>>>
>>
>> --
>> Laurie Harper
>> Open Source advocate, Java geek: http://www.holoweb.net/laurie
>> Founder, Zotech Software: http://www.zotechsoftware.com/
>>
>>
>>
>> _______________________________________________
>> Rails-spinoffs mailing list
>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>
>>
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
Why not create a class for this type of item and write your code this way:
Toggler = function(groupId) {
this.toggle = $(''toggle_''+groupId);
this.group = $(''group_''+groupId);
this.groupId = groupId;
this.clickEvent = function() {
Element.toggle(this.group);
this.toggle.innerHTML = (this.toggle.innerHTML == ''hide'') ?
''show'' :
''hide'';
Sortable.create(this.group.id,{
ghosting:true,constraint:false,
onUpdate:function(sortable) {
window.location
"ReorderWebCategory.action?groupIdsKey="+this.groupId+"&"+Sortable.serialize
(sortable)+"&toggleLevel="+toggleLevel+"#"+this.groupId;
new Effect.Pulsate(sortable);
// Note: wouldn''t this pulsate not fire because of the
window.location?
},
onChange:function(sortable) {
sortable.style.backgroundColor = ''#ffff00'';
}
});
return false;
}
Event.observe(this.toggle,''click'',this.clickEvent.bind(this));
}
Then you could just call
toggler_1929 = new Toggler(1929);
toggler.clickEvent(); // fire the click event manually
Just my $0.02 .... and as a disclaimer, if the above code is broken, I
didn''t have the time to test it, just wrote it off the top of my head.
Joe Potenza
Lead Developer
BigBuzz Internet Business Solutions
516.845.0702 x314
http://www.bigbuzz.com
-----Original Message-----
From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On
Behalf Of Jamie
Orchard-Hays
Sent: Monday, October 17, 2005 11:38 PM
To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: Re: [Rails-spinoffs] a better question
Thanks, both of you. I''ll try this when I get back to work tomorrow.
One thing I wonder about, I found a site that talks about the onclick
() method. It mentions that the event is not passed as an argument.
The observer and my code in the observer registration rely on this,
so I suspect that it won''t work (the "$group.id" references
are
server-side variables):
Event.observe("toggle_$group.id", ''click'',
function(event)
{ Element.toggle("group_$group.id");
Event.element(event).innerHTML
(Event.element(event).innerHTML == ''hide'' ?
''show'' : ''hide'');
Sortable.create("group_$group.id",
{ghosting:true,constraint:false,
onUpdate:function(sortable)
{window.location = "ReorderWebCategory.action?groupIdsKey=group_$
{group.id}&" + Sortable.serialize(sortable) +
"&toggleLevel=" +
toggleLevel + "#$group.id";
new Effect.Pulsate(sortable);},
onChange:function(sortable){$
(sortable.style.backgroundColor = "#ffff00");}
});
return false; });
Here''s the site I found:
http://www.quirksmode.org/js/
Jamie
On Oct 17, 2005, at 11:24 PM, Laurie Harper wrote:
> Doesn''t make sense to me at least ;-) If i click the link you show
> below, the browser is going to execute the Javascript expression
> "alert(''hello'')"; there''s no onclick()
function involved. In
> Jamie''s case, the function that gets called is the anonymous
> function he passes to Event.observe().
>
> Jamie, I think what you need to do (and maybe this is what Jon''s
> getting at) is to invoke the function that''s bound to the
''onclick''
> property of the element you''re interested in. This should do the
> trick:
>
> $(''toggle_1929'').onclick();
>
> So you were pretty close :-)
>
> L.
>
> On 17-Oct-05, at 9:16 PM, Whitcraft, Jon wrote:
>
>
>> onclick() is what function the browsers call when you click on
>> something. you set it by using click and call it with onclick()
>> becuase when you set it in a html tag it''s like this:
>>
>> <a href="javascript:void(0);"
onclick="alert(''hello'')">Click Here</a>
>>
>> does that make sense?
>>
>> Jon
>>
>> ________________________________
>>
>> From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org on
behalf of
>> Jamie Orchard-Hays
>> Sent: Mon 10/17/2005 6:02 PM
>> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> Subject: Re: [Rails-spinoffs] a better question
>>
>>
>>
>> I haven''t found onClick() defined as a method anywhere in
javascript
>> docs or in scriptaculous. Can you point me to this?
>>
>> Jamie
>>
>>
>> On Oct 17, 2005, at 5:07 PM, San Trois wrote:
>>
>>
>>
>>> It''s also the name of the function you need to call ;)
>>>
>>> --- Jamie Orchard-Hays <jamie-fswG1Ka7Iew@public.gmane.org>
wrote:
>>>
>>>
>>>
>>>
>>>> onClick is the event listener I''m trying to trigger.
>>>>
>>>> Jamie
>>>>
>>>>
>>>> On Oct 17, 2005, at 3:53 PM, Whitcraft, Jon wrote:
>>>>
>>>>
>>>>
>>>>
>>>>> Try using onclick().
>>>>>
>>>>> Jon Whitcraft
>>>>> Web Application Developer
>>>>> Online Services - Indianapolis Motor Speedway
>>>>> (317) 492-8623
>>>>>
>>>>> -----Original Message-----
>>>>> From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
>>>
>>>
>>>
>>>> On Behalf Of
>>>>
>>>>
>>>>
>>>>> Jamie
>>>>> Orchard-Hays
>>>>> Sent: Monday, October 17, 2005 2:32 PM
>>>>> To:
rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>> Subject: [Rails-spinoffs] a better question
>>>>>
>>>>> I''m trying to call a click() event on an <a
href>
>>>>>
>>>>>
>>>>>
>>>> that has an
>>>>
>>>>
>>>>
>>>>> Observable registered for it. Something like:
>>>>>
>>>>> <a href="#"
id="toggle_1929">show</a>
>>>>> ...
>>>>>
>>>>> Event.observe("toggle_1929",
''click'',
>>>>>
>>>>>
>>>>>
>>>> function(event){ Element.toggle
>>>>
>>>>
>>>>
>>>>> ("group_1929"); return false; });
>>>>> ...
>>>>>
>>>>> $("toggle_1929").click(); //this throws
"Error: $
>>>>> ("toggle_1929").click is not a function"
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Jamie
>>>>> _______________________________________________
>>>>> Rails-spinoffs mailing list
>>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>
>>>
>>>
>>>>> ********************
>>>>> ********************
>>>>> This E-mail (and attachments) may contain
>>>>>
>>>>>
>>>>>
>>>> confidential/privileged
>>>>
>>>>
>>>>
>>>>> information intended only for the named
>>>>>
>>>>>
>>>>>
>>>> addressee(s). If you are
>>>>
>>>>
>>>>
>>>>> not an intended recipient, do not read, copy,
>>>>>
>>>>>
>>>>>
>>>> disseminate or take
>>>>
>>>>
>>>>
>>>>> any action based on the content of this E-mail.
>>>>>
>>>>>
>>>>>
>>>> Please notify the
>>>>
>>>>
>>>>
>>>>> sender by reply E-mail and erase this E-mail from
>>>>>
>>>>>
>>>>>
>>>> your system. Your
>>>>
>>>>
>>>>
>>>>> assistance is appreciated. E-mail transmission may
>>>>>
>>>>>
>>>>>
>>>> not be secure or
>>>>
>>>>
>>>>
>>>>> error-free. The company is not responsible for any
>>>>>
>>>>>
>>>>>
>>>> loss/damage
>>>>
>>>>
>>>>
>>>>> arising from any virus transmitted.
>>>>> ********************
>>>>> ********************
>>>>> _______________________________________________
>>>>> Rails-spinoffs mailing list
>>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>
>>>
>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Rails-spinoffs mailing list
>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>
>>>>
>>>>
>>>>
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>
>>>
>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>> __________________________________
>>> Yahoo! Music Unlimited
>>> Access over 1 million songs. Try it free.
>>> http://music.yahoo.com/unlimited/
>>> _______________________________________________
>>> Rails-spinoffs mailing list
>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>
>>>
>>>
>>
>> _______________________________________________
>> Rails-spinoffs mailing list
>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>> ********************
>> ********************
>> This E-mail (and attachments) may contain confidential/privileged
>> information intended only for the named addressee(s). If you are
>> not an intended recipient, do not read, copy, disseminate or take
>> any action based on the content of this E-mail. Please notify the
>> sender by reply E-mail and erase this E-mail from your system.
>> Your assistance is appreciated. E-mail transmission may not be
>> secure or error-free. The company is not responsible for any loss/
>> damage arising from any virus transmitted.
>> ********************
>> ********************
>>
>> <winmail.dat>
>> _______________________________________________
>> Rails-spinoffs mailing list
>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>
>>
>
> --
> Laurie Harper
> Open Source advocate, Java geek: http://www.holoweb.net/laurie
> Founder, Zotech Software: http://www.zotechsoftware.com/
>
>
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Jamie,
Never saw anything about this after my email on Tuesday ..... did this
help?
Joe Potenza
Lead Developer
BigBuzz Internet Business Solutions
516.845.0702 x314
http://www.bigbuzz.com
-----Original Message-----
From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On
Behalf Of Joseph
Potenza
Sent: Tuesday, October 18, 2005 10:56 AM
To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: RE: [Rails-spinoffs] a better question
Why not create a class for this type of item and write your code this way:
Toggler = function(groupId) {
this.toggle = $(''toggle_''+groupId);
this.group = $(''group_''+groupId);
this.groupId = groupId;
this.clickEvent = function() {
Element.toggle(this.group);
this.toggle.innerHTML = (this.toggle.innerHTML == ''hide'') ?
''show'' :
''hide'';
Sortable.create(this.group.id,{
ghosting:true,constraint:false,
onUpdate:function(sortable) {
window.location
"ReorderWebCategory.action?groupIdsKey="+this.groupId+"&"+Sortable.serialize
(sortable)+"&toggleLevel="+toggleLevel+"#"+this.groupId;
new Effect.Pulsate(sortable);
// Note: wouldn''t this pulsate not fire because of the
window.location?
},
onChange:function(sortable) {
sortable.style.backgroundColor = ''#ffff00'';
}
});
return false;
}
Event.observe(this.toggle,''click'',this.clickEvent.bind(this));
}
Then you could just call
toggler_1929 = new Toggler(1929);
toggler.clickEvent(); // fire the click event manually
Just my $0.02 .... and as a disclaimer, if the above code is broken, I
didn''t have the time to test it, just wrote it off the top of my head.
Joe Potenza
Lead Developer
BigBuzz Internet Business Solutions
516.845.0702 x314
http://www.bigbuzz.com
-----Original Message-----
From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On
Behalf Of Jamie
Orchard-Hays
Sent: Monday, October 17, 2005 11:38 PM
To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: Re: [Rails-spinoffs] a better question
Thanks, both of you. I''ll try this when I get back to work tomorrow.
One thing I wonder about, I found a site that talks about the onclick
() method. It mentions that the event is not passed as an argument.
The observer and my code in the observer registration rely on this,
so I suspect that it won''t work (the "$group.id" references
are
server-side variables):
Event.observe("toggle_$group.id", ''click'',
function(event)
{ Element.toggle("group_$group.id");
Event.element(event).innerHTML
(Event.element(event).innerHTML == ''hide'' ?
''show'' : ''hide'');
Sortable.create("group_$group.id",
{ghosting:true,constraint:false,
onUpdate:function(sortable)
{window.location = "ReorderWebCategory.action?groupIdsKey=group_$
{group.id}&" + Sortable.serialize(sortable) +
"&toggleLevel=" +
toggleLevel + "#$group.id";
new Effect.Pulsate(sortable);},
onChange:function(sortable){$
(sortable.style.backgroundColor = "#ffff00");}
});
return false; });
Here''s the site I found:
http://www.quirksmode.org/js/
Jamie
On Oct 17, 2005, at 11:24 PM, Laurie Harper wrote:
> Doesn''t make sense to me at least ;-) If i click the link you show
> below, the browser is going to execute the Javascript expression
> "alert(''hello'')"; there''s no onclick()
function involved. In
> Jamie''s case, the function that gets called is the anonymous
> function he passes to Event.observe().
>
> Jamie, I think what you need to do (and maybe this is what Jon''s
> getting at) is to invoke the function that''s bound to the
''onclick''
> property of the element you''re interested in. This should do the
> trick:
>
> $(''toggle_1929'').onclick();
>
> So you were pretty close :-)
>
> L.
>
> On 17-Oct-05, at 9:16 PM, Whitcraft, Jon wrote:
>
>
>> onclick() is what function the browsers call when you click on
>> something. you set it by using click and call it with onclick()
>> becuase when you set it in a html tag it''s like this:
>>
>> <a href="javascript:void(0);"
onclick="alert(''hello'')">Click Here</a>
>>
>> does that make sense?
>>
>> Jon
>>
>> ________________________________
>>
>> From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org on
behalf of
>> Jamie Orchard-Hays
>> Sent: Mon 10/17/2005 6:02 PM
>> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> Subject: Re: [Rails-spinoffs] a better question
>>
>>
>>
>> I haven''t found onClick() defined as a method anywhere in
javascript
>> docs or in scriptaculous. Can you point me to this?
>>
>> Jamie
>>
>>
>> On Oct 17, 2005, at 5:07 PM, San Trois wrote:
>>
>>
>>
>>> It''s also the name of the function you need to call ;)
>>>
>>> --- Jamie Orchard-Hays <jamie-fswG1Ka7Iew@public.gmane.org>
wrote:
>>>
>>>
>>>
>>>
>>>> onClick is the event listener I''m trying to trigger.
>>>>
>>>> Jamie
>>>>
>>>>
>>>> On Oct 17, 2005, at 3:53 PM, Whitcraft, Jon wrote:
>>>>
>>>>
>>>>
>>>>
>>>>> Try using onclick().
>>>>>
>>>>> Jon Whitcraft
>>>>> Web Application Developer
>>>>> Online Services - Indianapolis Motor Speedway
>>>>> (317) 492-8623
>>>>>
>>>>> -----Original Message-----
>>>>> From:
rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]
>>>
>>>
>>>
>>>> On Behalf Of
>>>>
>>>>
>>>>
>>>>> Jamie
>>>>> Orchard-Hays
>>>>> Sent: Monday, October 17, 2005 2:32 PM
>>>>> To:
rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>> Subject: [Rails-spinoffs] a better question
>>>>>
>>>>> I''m trying to call a click() event on an <a
href>
>>>>>
>>>>>
>>>>>
>>>> that has an
>>>>
>>>>
>>>>
>>>>> Observable registered for it. Something like:
>>>>>
>>>>> <a href="#"
id="toggle_1929">show</a>
>>>>> ...
>>>>>
>>>>> Event.observe("toggle_1929",
''click'',
>>>>>
>>>>>
>>>>>
>>>> function(event){ Element.toggle
>>>>
>>>>
>>>>
>>>>> ("group_1929"); return false; });
>>>>> ...
>>>>>
>>>>> $("toggle_1929").click(); //this throws
"Error: $
>>>>> ("toggle_1929").click is not a function"
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Jamie
>>>>> _______________________________________________
>>>>> Rails-spinoffs mailing list
>>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>
>>>
>>>
>>>>> ********************
>>>>> ********************
>>>>> This E-mail (and attachments) may contain
>>>>>
>>>>>
>>>>>
>>>> confidential/privileged
>>>>
>>>>
>>>>
>>>>> information intended only for the named
>>>>>
>>>>>
>>>>>
>>>> addressee(s). If you are
>>>>
>>>>
>>>>
>>>>> not an intended recipient, do not read, copy,
>>>>>
>>>>>
>>>>>
>>>> disseminate or take
>>>>
>>>>
>>>>
>>>>> any action based on the content of this E-mail.
>>>>>
>>>>>
>>>>>
>>>> Please notify the
>>>>
>>>>
>>>>
>>>>> sender by reply E-mail and erase this E-mail from
>>>>>
>>>>>
>>>>>
>>>> your system. Your
>>>>
>>>>
>>>>
>>>>> assistance is appreciated. E-mail transmission may
>>>>>
>>>>>
>>>>>
>>>> not be secure or
>>>>
>>>>
>>>>
>>>>> error-free. The company is not responsible for any
>>>>>
>>>>>
>>>>>
>>>> loss/damage
>>>>
>>>>
>>>>
>>>>> arising from any virus transmitted.
>>>>> ********************
>>>>> ********************
>>>>> _______________________________________________
>>>>> Rails-spinoffs mailing list
>>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>
>>>
>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Rails-spinoffs mailing list
>>>>
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>>>
>>>>
>>>>
>>>>
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>
>>>
>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>> __________________________________
>>> Yahoo! Music Unlimited
>>> Access over 1 million songs. Try it free.
>>> http://music.yahoo.com/unlimited/
>>> _______________________________________________
>>> Rails-spinoffs mailing list
>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>>
>>>
>>>
>>
>> _______________________________________________
>> Rails-spinoffs mailing list
>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>> ********************
>> ********************
>> This E-mail (and attachments) may contain confidential/privileged
>> information intended only for the named addressee(s). If you are
>> not an intended recipient, do not read, copy, disseminate or take
>> any action based on the content of this E-mail. Please notify the
>> sender by reply E-mail and erase this E-mail from your system.
>> Your assistance is appreciated. E-mail transmission may not be
>> secure or error-free. The company is not responsible for any loss/
>> damage arising from any virus transmitted.
>> ********************
>> ********************
>>
>> <winmail.dat>
>> _______________________________________________
>> Rails-spinoffs mailing list
>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>>
>>
>
> --
> Laurie Harper
> Open Source advocate, Java geek: http://www.holoweb.net/laurie
> Founder, Zotech Software: http://www.zotechsoftware.com/
>
>
>
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
>
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Well, I wanted to get it done quickly and used some server-side hacking to get what I wanted. I end up with a Sortable defined twice, but I was running out of time. I also looked at using DOJO, which has some very slick even stuff going on. In the end, I just ran out of time to work on this with a fix in place. If I get some time, I''ll try out your code. Looks like it might work. Jamie On Oct 20, 2005, at 3:32 PM, Joseph Potenza wrote:> Jamie, > Never saw anything about this after my email on Tuesday ..... > did this > help? > > Joe Potenza > Lead Developer > BigBuzz Internet Business Solutions > 516.845.0702 x314 > http://www.bigbuzz.com > > > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of > Joseph > Potenza > Sent: Tuesday, October 18, 2005 10:56 AM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: RE: [Rails-spinoffs] a better question > > > Why not create a class for this type of item and write your code > this way: > > Toggler = function(groupId) { > this.toggle = $(''toggle_''+groupId); > this.group = $(''group_''+groupId); > this.groupId = groupId; > this.clickEvent = function() { > Element.toggle(this.group); > this.toggle.innerHTML = (this.toggle.innerHTML == ''hide'') ? > ''show'' : > ''hide''; > Sortable.create(this.group.id,{ > ghosting:true,constraint:false, > onUpdate:function(sortable) { > window.location > "ReorderWebCategory.action?groupIdsKey="+this.groupId > +"&"+Sortable.serialize > (sortable)+"&toggleLevel="+toggleLevel+"#"+this.groupId; > new Effect.Pulsate(sortable); > // Note: wouldn''t this pulsate not fire because of > the window.location? > }, > onChange:function(sortable) { > sortable.style.backgroundColor = ''#ffff00''; > } > }); > return false; > } > Event.observe(this.toggle,''click'',this.clickEvent.bind(this)); > } > > > Then you could just call > toggler_1929 = new Toggler(1929); > toggler.clickEvent(); // fire the click event manually > > > Just my $0.02 .... and as a disclaimer, if the above code is broken, I > didn''t have the time to test it, just wrote it off the top of my head. > > Joe Potenza > Lead Developer > BigBuzz Internet Business Solutions > 516.845.0702 x314 > http://www.bigbuzz.com > > > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of > Jamie > Orchard-Hays > Sent: Monday, October 17, 2005 11:38 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: Re: [Rails-spinoffs] a better question > > > Thanks, both of you. I''ll try this when I get back to work tomorrow. > One thing I wonder about, I found a site that talks about the onclick > () method. It mentions that the event is not passed as an argument. > The observer and my code in the observer registration rely on this, > so I suspect that it won''t work (the "$group.id" references are > server-side variables): > > Event.observe("toggle_$group.id", ''click'', function(event) > { Element.toggle("group_$group.id"); > Event.element(event).innerHTML > (Event.element(event).innerHTML == ''hide'' ? ''show'' : ''hide''); > Sortable.create("group_$group.id", > {ghosting:true,constraint:false, > onUpdate:function(sortable) > {window.location = "ReorderWebCategory.action?groupIdsKey=group_$ > {group.id}&" + Sortable.serialize(sortable) + "&toggleLevel=" + > toggleLevel + "#$group.id"; > new Effect.Pulsate(sortable);}, > onChange:function(sortable){$ > (sortable.style.backgroundColor = "#ffff00");} > }); > return false; }); > > Here''s the site I found: > > http://www.quirksmode.org/js/ > > Jamie > > > > On Oct 17, 2005, at 11:24 PM, Laurie Harper wrote: > > >> Doesn''t make sense to me at least ;-) If i click the link you show >> below, the browser is going to execute the Javascript expression >> "alert(''hello'')"; there''s no onclick() function involved. In >> Jamie''s case, the function that gets called is the anonymous >> function he passes to Event.observe(). >> >> Jamie, I think what you need to do (and maybe this is what Jon''s >> getting at) is to invoke the function that''s bound to the ''onclick'' >> property of the element you''re interested in. This should do the >> trick: >> >> $(''toggle_1929'').onclick(); >> >> So you were pretty close :-) >> >> L. >> >> On 17-Oct-05, at 9:16 PM, Whitcraft, Jon wrote: >> >> >> >>> onclick() is what function the browsers call when you click on >>> something. you set it by using click and call it with onclick() >>> becuase when you set it in a html tag it''s like this: >>> >>> <a href="javascript:void(0);" onclick="alert(''hello'')">Click >>> Here</a> >>> >>> does that make sense? >>> >>> Jon >>> >>> ________________________________ >>> >>> From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org on behalf of >>> Jamie Orchard-Hays >>> Sent: Mon 10/17/2005 6:02 PM >>> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> Subject: Re: [Rails-spinoffs] a better question >>> >>> >>> >>> I haven''t found onClick() defined as a method anywhere in javascript >>> docs or in scriptaculous. Can you point me to this? >>> >>> Jamie >>> >>> >>> On Oct 17, 2005, at 5:07 PM, San Trois wrote: >>> >>> >>> >>> >>>> It''s also the name of the function you need to call ;) >>>> >>>> --- Jamie Orchard-Hays <jamie-fswG1Ka7Iew@public.gmane.org> wrote: >>>> >>>> >>>> >>>> >>>> >>>>> onClick is the event listener I''m trying to trigger. >>>>> >>>>> Jamie >>>>> >>>>> >>>>> On Oct 17, 2005, at 3:53 PM, Whitcraft, Jon wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> Try using onclick(). >>>>>> >>>>>> Jon Whitcraft >>>>>> Web Application Developer >>>>>> Online Services - Indianapolis Motor Speedway >>>>>> (317) 492-8623 >>>>>> >>>>>> -----Original Message----- >>>>>> From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] >>>> >>>> >>>> >>>> >>>>> On Behalf Of >>>>> >>>>> >>>>> >>>>> >>>>>> Jamie >>>>>> Orchard-Hays >>>>>> Sent: Monday, October 17, 2005 2:32 PM >>>>>> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>>> Subject: [Rails-spinoffs] a better question >>>>>> >>>>>> I''m trying to call a click() event on an <a href> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> that has an >>>>> >>>>> >>>>> >>>>> >>>>>> Observable registered for it. Something like: >>>>>> >>>>>> <a href="#" id="toggle_1929">show</a> >>>>>> ... >>>>>> >>>>>> Event.observe("toggle_1929", ''click'', >>>>>> >>>>>> >>>>>> >>>>>> >>>>> function(event){ Element.toggle >>>>> >>>>> >>>>> >>>>> >>>>>> ("group_1929"); return false; }); >>>>>> ... >>>>>> >>>>>> $("toggle_1929").click(); //this throws "Error: $ >>>>>> ("toggle_1929").click is not a function" >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Jamie >>>>>> _______________________________________________ >>>>>> Rails-spinoffs mailing list >>>>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >>>> >>>> >>>> >>>> >>>>>> ******************** >>>>>> ******************** >>>>>> This E-mail (and attachments) may contain >>>>>> >>>>>> >>>>>> >>>>>> >>>>> confidential/privileged >>>>> >>>>> >>>>> >>>>> >>>>>> information intended only for the named >>>>>> >>>>>> >>>>>> >>>>>> >>>>> addressee(s). If you are >>>>> >>>>> >>>>> >>>>> >>>>>> not an intended recipient, do not read, copy, >>>>>> >>>>>> >>>>>> >>>>>> >>>>> disseminate or take >>>>> >>>>> >>>>> >>>>> >>>>>> any action based on the content of this E-mail. >>>>>> >>>>>> >>>>>> >>>>>> >>>>> Please notify the >>>>> >>>>> >>>>> >>>>> >>>>>> sender by reply E-mail and erase this E-mail from >>>>>> >>>>>> >>>>>> >>>>>> >>>>> your system. Your >>>>> >>>>> >>>>> >>>>> >>>>>> assistance is appreciated. E-mail transmission may >>>>>> >>>>>> >>>>>> >>>>>> >>>>> not be secure or >>>>> >>>>> >>>>> >>>>> >>>>>> error-free. The company is not responsible for any >>>>>> >>>>>> >>>>>> >>>>>> >>>>> loss/damage >>>>> >>>>> >>>>> >>>>> >>>>>> arising from any virus transmitted. >>>>>> ******************** >>>>>> ******************** >>>>>> _______________________________________________ >>>>>> Rails-spinoffs mailing list >>>>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >>>> >>>> >>>> >>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> _______________________________________________ >>>>> Rails-spinoffs mailing list >>>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>> >>>>> >>>>> >>>>> >>>>> >>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >>>> >>>> >>>> >>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> >>>> __________________________________ >>>> Yahoo! Music Unlimited >>>> Access over 1 million songs. Try it free. >>>> http://music.yahoo.com/unlimited/ >>>> _______________________________________________ >>>> Rails-spinoffs mailing list >>>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >>>> >>>> >>>> >>>> >>> >>> _______________________________________________ >>> Rails-spinoffs mailing list >>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >>> ******************** >>> ******************** >>> This E-mail (and attachments) may contain confidential/privileged >>> information intended only for the named addressee(s). If you are >>> not an intended recipient, do not read, copy, disseminate or take >>> any action based on the content of this E-mail. Please notify the >>> sender by reply E-mail and erase this E-mail from your system. >>> Your assistance is appreciated. E-mail transmission may not be >>> secure or error-free. The company is not responsible for any loss/ >>> damage arising from any virus transmitted. >>> ******************** >>> ******************** >>> >>> <winmail.dat> >>> _______________________________________________ >>> Rails-spinoffs mailing list >>> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >>> >>> >>> >> >> -- >> Laurie Harper >> Open Source advocate, Java geek: http://www.holoweb.net/laurie >> Founder, Zotech Software: http://www.zotechsoftware.com/ >> >> >> >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> >> > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >