push 函数 loading加载需要的函数

2011-08-10 17:26:00 by 【6yang】, 166 visits, 收藏 | 返回

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title></title> 
</head> 
<script src="js/jquery-1.6.2.min.js"></script>
<body> 
<style type="text/css">
#graphLoadingText{
    display:block;
}
.p-state-loading {
    background: #fff;
    color: #FF9900;
    font-size: 18px;
    opacity: 0.7;
    position: absolute;
    text-align: center;
    z-index: 9999;
}
</style>
 
<SCRIPT LANGUAGE="JavaScript">
<!--
function errorDebug(e,code) {

    var t = '';
    if(typeof(e.description)=='undefined') {
        t = e;
    } else {
        t = e.description;
    }
    var init = code.match(/^document.(page|ajax)Init[(d)]/);
    if(init) {
        // this just displays "document.(page|ajax)Init[x]", but we want the actual code inside that array
        if(init[1]=='page') {
            code += " source: "+document.pageInit[init[2]];
        } else if(init[1]=='ajax') {
            code += " source: "+document.ajaxInit[init[2]];
        }
    }

    try{ 
       
        console.log("Error evaluating code: "+t+" code: "+code);

    }catch(e){
       
         $('#errors').append("<pre>Error evaluating code: "+t+" code: "+code+'</pre>');

    }

    //alert("Error evaluating code: "+t+" code: "+code);
}
function callFunction(func,name) {

    try {
        func();
    } catch(e) {
       
        errorDebug(e,name);
    }
}
if(typeof(Array.prototype.removeAt)=='undefined') {
    Array.prototype.removeAt = function(idx) {
        this.splice(idx,1);
    };
}
document.pageInit = [];
function doPageInit() {
    //showPageLoadProgress();
    if(typeof(document.pageInit)=='object') {
        for(var i=0;i<document.pageInit.length;i++) {
            if(typeof(document.pageInit[i])=='function') {
                //alert('document.pageInit['+i+']');
                callFunction(document.pageInit[i],"document.pageInit["+i+"]");
                // only call a function every 100ms so we don't overload JS
                document.pageInit.removeAt(i);
                //document.pageTimers.push(setTimeout("doPageInit()",50));
                //return;
            }
        }
    } else if(typeof(document.pageInit)=='function') {
        //alert('document.pageInit');
        callFunction(document.pageInit,"document.pageInit");
    }
    document.pageInit = [];
}
document.pageInit.push(function(){       
    alert(31);
},
function(){
    alert(2);
});
doPageInit();
//-->
</SCRIPT>

</body> 
</html> 

分享到:
share

    图片原图

    loading

    loading