[TurboGears] Re: [mochikit]How to add onclick attr to DOM?

2006-04-20 Thread Eric Larson
I am not sure exactly what MochiKit does, but it may add the onclick directly to the object when it is created. Sorry that this is very vague, but maybe it will help you looking through the docs or code.Best, 
EricOn 4/20/06, Henotii [EMAIL PROTECTED] wrote:
I just follow the doc of mochikit, and use A({href:#}, test) toadd element successful.But it seems can't work with A({onclick:test_func()}, test).
The output html just like this atest/a, and without the onclick.Is there something wrong? And how can I add attr like onclick whenusing MochiKit. The mochikit's doc is not very clear in this.

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


[TurboGears] Re: [mochikit]How to add onclick attr to DOM?

2006-04-20 Thread isaac
use the web developer toolbar in FireFox and try View Generated
Source. This type of change may not show with a normal view source.

Also try:

A({onclick:test_func}, test)

which is passing the function itself.

or look at using setNodeAttribute (see DOM section of docs).

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



[TurboGears] Re: [mochikit]How to add onclick attr to DOM?

2006-04-20 Thread Dan Weeks

On 2006-04-20 11:15:55 -0500, isaac wrote:
 use the web developer toolbar in FireFox and try View GeneratedSource.
 This type of change may not show with a normal view source.  

another Firefox extension that is handy in that regard is View Source Chart:

http://jennifermadden.com/scripts/ViewRenderedSource.html

Dan

-- 
Software Developer
Wild Brain, Inc.
http://www.wildbrain.com/

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



[TurboGears] Re: [mochikit]How to add onclick attr to DOM?

2006-04-20 Thread Bob Ippolito


On Apr 20, 2006, at 1:34 AM, Henotii wrote:


 I just follow the doc of mochikit, and use A({href:#}, test) to
 add element successful.
 But it seems can't work with A({onclick:test_func()}, test).
 The output html just like this atest/a, and without the onclick.

 Is there something wrong? And how can I add attr like onclick when
 using MochiKit. The mochikit's doc is not very clear in this.

It should work if you use::

 A({onclick: test_func}, test)

-bob


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



[TurboGears] Re: [mochikit]How to add onclick attr to DOM?

2006-04-20 Thread Henotii
That's very kind of u all,
I made the code go well now:)

ps: I just found ffx is so good to help dev ^o^
On 4/21/06, Bob Ippolito [EMAIL PROTECTED] wrote:


 On Apr 20, 2006, at 1:34 AM, Henotii wrote:

 
  I just follow the doc of mochikit, and use A({href:#}, test) to
  add element successful.
  But it seems can't work with A({onclick:test_func()}, test).
  The output html just like this atest/a, and without the onclick.
 
  Is there something wrong? And how can I add attr like onclick when
  using MochiKit. The mochikit's doc is not very clear in this.

 It should work if you use::

  A({onclick: test_func}, test)

 -bob


 



--
Wenjie

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