Pages: 1

  2008-08-31 02:09:59

tekfatliu
» n00b
FTalk Level: zero
69
0
1969-12-31

MooTools: DOM Ready event Suppose you want to add something below your groups box (id='8') in your Friendster profile. [code]function myFunction(){ ... addBox("RIGHT","","","cssid","8"); ... }[/code]

MooTools: DOM Ready event Suppose you want to add something below your groups box (id='8') in your Friendster profile. <">The JS code might not work unless you execute it after the groups box have loaded, because whenever you reference items in the DOM (the Document Object Model), they must already be loaded in the browser (it depends on how fast your groups box is loaded before myFunction() get executed). Remember: you paste your JS linker in About Me or Who I Want To Meet or Media Box, it is before the groups box. One solution to overcome this, is by using setTimeout(). Then myFunction() will be executed after a certain amount of time. But still you never know when the groups box had already finished loading. It's just a matter of too late, or too soon. <">or even better by using window.onload - you execute your code after the page loads, but the "load" event waits for everything to load -> images, css files, whatever. <">This is the onload version of MooTools, I recommend you using this version ;-p <">To wait for the whole page to load? ;-( the "load" event waits for everything to load - images, css files, whatever. This is where the event "domready" comes into play. This event fires when the HTML page is loaded, even if the other assets (images, etc.) are not. <">I have a suggestion for the moderator to make a separate section for MooTools, so people who dislike MooTools or want to read about JavaScript only don't have to bother to read MooTools regarding post. And people who want to look for posts regarding MooTools know where to look for. But of course the post must have something to do with Friendster Tweaking. In the meantime, I will include the word "MooTools: ", in the subject of my posts regarding MooTools. If you like this idea, please post a comment to support this. If there are many people likes the idea, i think the moderator would consider it. So why MooTools? there are other frameworks out there such as Dojo, YUI, Prototype, JQuery etc. This is just one reason why. http://clientside.cnet.com/wiki/mootorialwiki/mootorial/0-mootoolsvsothers Besides, for me the main reason is Friendster already included MooTools in our profiles. Why don't we use it? And let say you've included other frameworks, it will make your JS files will become bigger and slower, not to mention the compatibility issues. Your JS codes MIGHT NOT work at all.

Pages: 1

Board footer

© 2024 F Talk

Current time is 22:20

[ 12 queries - 0.018 second ]
Privacy Policy