preloeading script

DarkSummer

Erfahrenes Mitglied
hi ich hatte mal von ner seite 1 proloading script runtergeladen nur es stop jedesmal beim vorletzen bild hier mal der code wär cool wenn ihr mir helfen könntet das es geht
PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>-team vh - proloading images</title>

<? include("config.php"); ?>
<? echo "$page_stylesheet"; ?>
<script language="JavaScript1.2">
<!-- begin hiding

startingColor = new Array() // <-- Nicht ändern!
endingColor = new Array() // <-- Nicht ändern!

// Hier alle Bilder angeben die vorgeladen werden sollen:
var yourImages = new Array ("gfx/bg_navi_left.gif", "gfx/bg_navi_right.gif", "gfx/copyright", "gfx/left_navi.gif", "gfx/mail.gif", "gfx/navi_clanwars.gif", "gfx/navi_community.gif", "gfx/navi_files.gif", "gfx/navi helden.gif", "gfx/navi_news.gif", "gfx/navi_stats.gif"); // Ende Bilder
var locationAfterPreload = "news.php" // Hier die Seite angeben zu der nach Vorladen weitergeleitet werden soll
var preloadbarWidth = 300 // Die Länge des Vorladestatusbalkens!
var preloadbarHeight = 15 // Die Höhe des Vorladestatusbalkens
var backgroundOfGradient = "#0000000" // Die Hintergrundfarbe des Vorladebalkens

// Startfarbwert des Vorladebalkens - Es muss dabei die der erste, dritte und fünfte Wert des entsprechenden Hexadezimalcodes angegeben werden
startingColor[0] = "b"
startingColor[1] = "c"
startingColor[2] = "5"
// Endfarbwert des Vorladebalkens - Es muss dabei die der erste, dritte und fünfte Wert des entsprechenden Hexadezimalcodes angegeben werden
endingColor[0] = "0"
endingColor[1] = "0"
endingColor[2] = "0"

// BEI PROBLEMEN:
var gap = 7 // BEI JAVASCRIPT ERROR mit diesem Wert experimentieren!!! 2 ist der minimale Wert!!!


// AB HIER NICHTS MEHR ÄNDERN

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 = "Loaded " + currCount + " out of " + imgLen + " images [" + percent + "%].";
		pending--;
		checkLoad();
		return;
	}
	eval("document.all.cell" + (h+1) + ".style.backgroundColor = hilite[h]");;
	h++;
	setTimeout("changeto()",1);
}
defaultStatus = "Loaded 0 out of " + imgLen + " images [0%]."
// end hiding -->
</script>
</head>
<body bgcolor=#000000 scroll="no">
<center>



<font face="Verdana, Arial, Helvetica" size="2" color="#003366"><center>Bitte warten !</center><br>
<font face="Verdana, Arial, Helvetica" size="2" color="#003366"><center>Die Bilder werden geladen ...</center><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>');
document.write('<p><small><a href="javascript:location.replace(locationAfterPreload)">Vorladen überspringen !</a></small></p></font>')
loadImages();
// end hiding -->
</script>
</font></font></center>

</body>
</html>
 
Java != JavaScript

wollt nur sagen, dasses im falschen forum ist, bevor du dich wunderst, dass vllt. keiner antwortet ;)

bye
 

Neue Beiträge

Zurück