|
TP-Greis
Registriert seit: Mar 2001
Ort: Berlin, Germany
|
Re: Preloader Grafik
Schei**e, irgendwo hab ich wohl Mist gebaut - bis vor ner Weile ging es auch mit Netscape und Opera ...
Ich kann leider nicht mehr entdecken, wo der Fehler liegt! Es ging eigentlich mit allen Browsern!
Was stimmt denn hier nicht?
<script language="JavaScript1.2">
<!-- begin hiding
startingColor = new Array(); // <-- Do not modify!
endingColor = new Array(); // <-- Do not modify!
// YOU MAY MODIFY THE FOLLOWING:
var yourImages = new Array("bilder/adalogo.gif","bilder/tanzevents1.gif","bilder/tanzevents2.gif","bilder/tanzkurse1.gif","bilder/tanzkurse2.gif","bilder/tanzen1.gif","bilder/tanzen2.gif","bilder/tanzshops1.gif","bilder/tanzshops2.gif","bilder/tanzpartner1.gif","bilder/tanzpartner2.gif","bilder/tausch1.gif","bilder/tausch2.gif","bilder/buch1.gif","bilder/buch2.gif","bilder/links1.gif","bilder/links2.gif","bilder/sms1.gif","bilder/sms2.gif","bilder/hilfe1.gif","bilder/hilfe2.gif","bilder/mittelinks.gif","bilder/obenlinkslogo.gif","bilder/obennav1.gif","bilder/obennav12.gif","bilder/obennav2.gif","bilder/obennav22.gif","bilder/obennav3.gif","bilder/obennav32.gif","bilder/obenrechts.gif","bilder/untenlinks.gif"); // Fill this array with the images you wish to preload
var locationAfterPreload = "index2.html"; // The script will redirect here when the preloading finishes *successfully*
var preloadbarWidth = 250; // The length of the preload bar. Should be greater than total amount of images you want to preload!
var preloadbarHeight = 15; // The height of the gradient/preload bar
var backgroundOfGradient = "#000000"; // Default color while the preload bar is "filling up"
// Color the preloadbar is starting with - enter 1st, 3rd and 5th numbers/letters of color code
startingColor[0] = "f";
startingColor[1] = "0";
startingColor[2] = "0";
// Color the preloadbar is going to end up with - enter the 1st, 3rd and 5th numbers/letters of color code
endingColor[0] = "0";
endingColor[1] = "0";
endingColor[2] = "f";
// FOR TROUBLESHOOTING:
var gap = 7; // PLAY AROUND WITH THIS SETTING IF YOU GET A JAVASCRIPT ERROR!!! 2 is the minumum value!!!
// DO NOT MODIFY ANYTHING BEYOND THIS POINT!!!
if (!document.all) location.replace(locationAfterPreload)
var a = 10, b = 11, c = 12, d = 13, e = 14, f=15, i, j, ones = new Array(), sixteens = new Array(), diff = new Array();
var convert = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"), imgLen = yourImages.length;
var loaded = new Array(), preImages = new Array(), currCount = 0, pending = 0, h = 0, hilite = new Array(), cover = new Array();
var num = Math.floor(preloadbarWidth/gap);
for (i = 0; i < 3; i++) {
startingColor[i] = startingColor[i].toLowerCase();
endingColor[i] = endingColor[i].toLowerCase();
startingColor[i] = eval(startingColor[i]);
endingColor[i] = eval(endingColor[i]);
diff[i] = (endingColor[i]-startingColor[i])/num;
ones[i] = Math.floor(diff[i]);
sixteens[i] = Math.round((diff[i] - ones[i])*15);
}
endingColor[0] = 0;
endingColor[1] = 0;
endingColor[2] = 0;
i = 0, j = 0;
while (i <= num) {
hilite[i] = "#";
while (j < 3) {
hilite[i] += convert[startingColor[j]];
hilite[i] += convert[endingColor[j]];
startingColor[j] += ones[j];
endingColor[j] += sixteens[j];
if (endingColor[j] > 15) {
endingColor[j] -= 15;
startingColor[j]++;
}
j++;
}
j = 0;
i++;
}
function loadImages() {
for (i = 0; i < imgLen; i++) {
preImages[i] = new Image();
preImages[i].src = yourImages[i];
loaded[i] = 0;
cover[i] = Math.floor(num/imgLen)*(i+1)
}
cover[cover.length-1] += num%imgLen
checkLoad();
}
function checkLoad() {
if (pending) { changeto(); return }
if (currCount == imgLen) { location.replace(locationAfterPreload); return }
for (i = 0; i < imgLen; i++) {
if (!loaded[i] && preImages[i].complete) {
loaded[i] = 1; pending++; currCount++;
checkLoad();
return;
}
}
setTimeout("checkLoad()",10);
}
function changeto() {
if (h+1 > cover[currCount-1]) {
var percent = Math.round(100/imgLen)*currCount;
if (percent > 100) while (percent != 100) percent--;
if (currCount == imgLen && percent < 100) percent = 100;
defaultStatus = "Fertig: " + currCount + " von " + imgLen + " Bildern [" + percent + "%].";
pending--;
checkLoad();
return;
}
eval("document.all.cell" + (h+1) + ".style.backgroundColor = hilite[h]");;
h++;
setTimeout("changeto()",1);
}
defaultStatus = "Fertig: 0 von " + imgLen + " Bildern [0%]."
// end hiding -->
</script>
</head>
<body bgcolor="FFFFFF" link="#667799" vlink="#445577" alink="#445577">
<table border="0" width="100%" height="100%">
<tr align="center" valign="center"><td>
<B>Bilder werden geladen ...</B>
<br><br>
<script language="JavaScript1.2">
<!-- beging hiding
document.write('<table border="0" cellpadding="0" cellspacing="0" width="' + preloadbarWidth + '"><tr height="' + preloadbarHeight + '" bgcolor="' + backgroundOfGradient + '">');
for (i = 0; i < num; i++) {
document.write('<td width="' + gap + '" id="cell' + (i+1) + '"></td>');
}
document.write('</tr></table>');
loadImages();
// end hiding -->
</script>
[Edited by Adagio on 15.04.01 at 19:35 GMT]
__________________
“My software never has bugs. It just develops random features ...”
» DevShack - die Website des freien Webentwicklers Boris
|