José de Paula Eufrásio Júnior wrote:
> So, I guess everybody comes to that someday...
> 
> I did some nice "onclick" and "onchange" and "onsomething" javascript
> functions last night. They work great on Mozilla. IE don't even
> returns an error.

You have to enable JavaScript error reporting in the advanced 
preferences of IE. It's also a good idea to install the Microsoft Script 
debugger.

> But Kid doesn't allow me to make a template with
> onclick=function(param), it complains about malformed (x)html (and it
> is, indeed).

> I searched the google oracle and seems that there's a lot more about
> this event business between the browsers, mainly about using
> javascript to setup event handlers instead of using the "onclick",
> "onstuff".

Indeed. Use the 'connect' function from MochiKit to attach handlers to 
events, it will save you a lot of hassle:

http://www.mochikit.com/doc/html/MochiKit/Signal.html#fn-connect

You need to give elements, to which you want to attach a handler, an ID 
or a CLASS attribute and then use MochiKit's 'getElement' or 
'getElementByTagAndClassName' functions to locate the element(s) and 
attach the handler with 'connect'.

It is best to do this in a function that is executed after the page has 
loaded. There is the 'windows.onload' element, but this fires only when 
the whole page including all binary content, i.e. images etc. has 
loaded, which often leads to a noticable delay in your page 
initialization. It is better to use the 'DOMContentLoad' event, but 
unfortunately this is non-standard and not supported by IE. For a 
workaround, see:

http://dean.edwards.name/weblog/2006/06/again/

HTH, Chris

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to