I see what he is saying now. When you assign a click event with the
Event.observe it does not allow you to call it with the
$(''xxx'').onclick(); command as it''s looking for the
onclick tag in the a
tag.
I''m stumped on a way to get this to work.
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: Tuesday, October 18, 2005 8:50 AM
To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: [Rails-spinoffs] Error: "onclick() is not a function"
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
>
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs