SoFunction
Updated on 2025-04-03

Another small picture preload class


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<SCRIPT LANGUAGE="JavaScript">
<!--
var IE==="Microsoft Internet Explorer";
var Opera=()=="opera";
var FF=!IE && !Opera;
function LoadImage(arrSrc,callBack)
{
    =;
=0;    //The number of pictures that have been loaded
    var self=this;
    if(<1)
    {
        callBack(arrSrc);
        return;
    }

//After testing, OPERA loads differently from other browsers, so it is particularly independent...
    if(Opera)
    {
        for(var i=0;i<;i++)
        {
            var tmpImg=new Image();
            =arrSrc[i];
            =function()
            {
                ++;
                if(== && callBack)    callBack(arrSrc);
            }
        }
        return;
    }

    =function()
    {
        ++;
        ("counter").innerHTML=;
        if(<)    ();
        else if(callBack)    callBack(arrSrc);
    }

    =function()
    {
        var tmpImg=new Image();
        =arrSrc[];
        if(IE)
        {
            if(=="complete")    ();
            else    =function()
            {
                if(=="complete")    ();
            }
        }
        else    =;
    }
    ();
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<div ></div>
 <SCRIPT LANGUAGE="JavaScript">
 <!--
    var arr=['/photo/20060531/20060531103027226_756_o.jpg','/bbs/2007_02/13/','http://img./2006/09/09/15032/'];
    var t=new LoadImage(arr,function(arr)
    {

        var str="";
        for(var i=0;i<;i++)
        {
            str+="<img src='"+arr[i]+"' /><br>";
        }
        +=str;
    });
 //-->
 </SCRIPT>
</BODY>
</HTML>