Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Organizing onload events
- From: wdlists at triche-osborne.com (Triche Osborne)
- Subject: [Javascript] Organizing onload events
- Date: Fri Sep 22 10:06:12 2006
The more I use unobtrusive methods, the longer my external onload script gets and the more often I run into situations where I have events that are only required for given pages. Is it standard practice to include all of these event attachments in a single file which is loaded for every page, regardless of whether the page needs the script (and the overhead), or do you tailor the scripts to a given page or section? Also, what of scripts that require arguments for the functions called by the attached events? Example: an optional popup function that requires the pathname, width and height of the image it is to display. Since I'm often creating these pages via PHP and want to keep them as simple as possible for the end-user to style, I've thought of assigning a class="popup" and coded ID to the thumbnail (something like id="img12345678-300-400"). This seems awkward, but so does writing out an associative multi-dim array for the page's affected elements. (Since the event may or may not need to be attached, depending on whether there is an enlargement available, I can't just grab all IMG children within the item DIVs.) Am I overlooking a really obvious, simple solution? Triche Osborne
- Follow-Ups:
- [Javascript] Organizing onload events
- From: Paul Novitski
- [Javascript] Organizing onload events
- Prev by Date: [Javascript] Image PreLoad
- Next by Date: [Javascript] How to decode obfuscated Javscript
- Previous by thread: [Javascript] how to disable right click mouse option in IE browser
- Next by thread: [Javascript] Organizing onload events
- Index(es):