window.onload 전에 이미지나 리소스가 로딩되기 전에 일어나는 이벤트이다.
다만 ie에서는 버그가 있어서 잘 되지 않는 경우가 있다.

출처 : http://blog.iolo.pe.kr/284

onReady = (function(ie){
    var d = document;
    return ie ? function(c){
        var n = d.firstChild,
        f = function(){
            try{
                c(n.doScroll('left'))
            }catch(e){
                setTimeout(f, 10)
            }
        }; f()
    } : 
    /webkit|safari|khtml/i.test(navigator.userAgent) ? function(c){
        var f = function(){
            /loaded|complete/.test(d.readyState) ? c() : setTimeout(f, 10)
        }; f()
    } : 
    function(c){
        d.addEventListener("DOMContentLoaded", c, false);
    }
})(/*@cc_on 1@*/);

onReady(function(){

    alert("Hello DOM");

});

posted by 뚱2