§ Adding events to elements
For most elements, you can just do element.onclick = function_name. But read on...
(Much better article available at Add and Remove Elements with JavaScript (reprise) from Dustin Diaz.)
§ window.onload via double delegate function
This is the way I add javascript functions to the window.onload event. As far as I've seen, you can load endless functions this way.
Lifted straight from Robert Hahn's blog: http://blog.roberthahn.ca/articles/2007/02/02/how-to-use-window-onload-the-right-way
Thank you! Bless you! What a headache.
Categories
Comments
- Walid on "Adventures with Ubuntu 9.10 on G4 Yikes!" - I am in the same process as you. Although I still dual-boot to Windows for my ganimg leisure. My first contact with Ubuntu was way…
- Slashback on "Simpler adding & removing element classnames" - Actually, the addClassName function does what you want, pretty much the same way you suggest.
- angie on "Simpler adding & removing element classnames" - And what if I want to add a class, but keeping the csseals the element already has?I mean, I have an element with a class, let's name…
- backlinks on "Adjust iframe height to contents" - Definitely helped me.
- Slashback on "Simpler validate form fields are filled in (no additional class names)" - You are welcome!