Javascript depends on the browser. It may be that IE 6 does not support your image pre-loading function.
You can refer to the following code to pre-load images using JavaScript:
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML>
<Head>
<Title> new document </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Script language = "JavaScript">
<! --
VaR Ie = navigator. appname = "Microsoft Internet Explorer ";
VaR opera = navigator. appname. tolowercase () = "Opera ";
VaR FF =! IE &&! Opera;
Function LoadImage (arrsrc, callback)
{
This. Length = arrsrc. length;
This. loadedlen = 0; // number of images already loaded
VaR self = this;
If (self. Length <1)
{
Callback (arrsrc );
Return;
}
// According to the test, the loading method of opera is different from that of other browsers, so it is particularly independent...
If (opera)
{
For (VAR I = 0; I <self. length; I ++)
{
VaR tmpimg = new image ();
Tmpimg. src = arrsrc [I];
Tmpimg. onload = function ()
{
Self. loadedlen ++;
If (self. loadedlen = self. Length & callback) callback (arrsrc );
}
}
Return;
}
This. load = function ()
{
Self. loadedlen ++;
Document. getelementbyid ("counter"). innerhtml = self. loadedlen;
If (self. loadedlen <self. Length) self. downimg ();
Else if (callback) callback (arrsrc );
}
This. downimg = function ()
{
VaR tmpimg = new image ();
Tmpimg. src = arrsrc [self. loadedlen];
If (IE)
{
If (tmpimg. readystate = "complete") self. Load ();
Else tmpimg. onreadystatechange = function ()
{
If (this. readystate = "complete") self. Load ();
}
}
Else tmpimg. onload = self. load;
}
This. downimg ();
}
// -->
</SCRIPT>
</Head>
<Body>
<Div id = "counter"> </div>
<Script language = "JavaScript">
<! --
VaR arr = ['HTTP: // response
VaR T = new LoadImage (ARR, function (ARR)
{
VaR STR = "";
For (VAR I = 0; I <arr. length; I ++)
{
STR + = " <br> ";
}
Document. Body. innerhtml + = STR;
});
// -->
</SCRIPT>
</Body>
</Html>