Kwa Kil On Swa

Saturday, March 10, 2007

appfuse window.onload defined in global.js

Appfuse defines window.onload in global.js and as this is usually includes by all jsps, its NOT a good idea to define <body onload="myOnLoadFunction()"> as this overrides the window.onload function set up by global.js

So what does the appfuse window.onload function do?

3 things:
1) highlightFormElements() - this gives you the yellow background when you mouseover form fields
2) Scriptaculous effect to highlight the appfuse standard success and failure messages
3) Installs handlers for the mouseover on the top level menus (not important for popups)

So rather than a <body onload="myOnLoadFunction()">

you should say,

var previousWindowOnLoadFn = window.onload

window.onload = function() {
myOnLoadFunction();
previousWindowOnLoadFn();
}

0 Comments:

Post a Comment

<< Home