2012年11月4日 星期日

Multiple method on onload

1. Problem:
we can do something in window.load position such as arrange the layout,
but there are only one method in this window.onload function.


2. Solution
we can store the previous onload method,
and build a new anomyous function which put the old_onload_method,
adding the new load_method.

var oldOnload = window.onload || function () {};
window.onload = function ()
{
    oldOnload();
    // Do Something...
}

Reference:
http://www.jaceju.net/blog/archives/160/

沒有留言:

張貼留言