Hi Leute!
Zunächt einmal ein kleiner Hinweis: Ich bin der totale Noob im Webdesign... also bitte nicht lachen
Jetzt zu meinem Problem:
Ich habe mir auf der HP von Michael Mailer, das Preload script geladen und in den Head-Bereich meiner HP eingefügt.
Das Script läd die Bilder wie gewünscht, aber der Preloader hängt ganz oben im Browser.
Ich hätte den Preloader aber gerne in der Mitte des Browsers!
wie stelle ich das an?
PS: wer das script nicht kennt hier ist es:
</head>
<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("gfx/banner_468_1.gif", "gfx/banner_468_2.gif") // Fill this array with the images you wish to preload
var locationAfterPreload = "popup.php" // 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 = 10 // 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] = "f"
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] = "c"
endingColor[1] = "0"
endingColor[2] = "0"
// 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 = startingColor.toLowerCase();
endingColor = endingColor.toLowerCase();
startingColor = eval(startingColor);
endingColor = eval(endingColor);
diff = (endingColor-startingColor)/num;
ones = Math.floor(diff);
sixteens = Math.round((diff - ones)*15);
}
endingColor[0] = 0;
endingColor[1] = 0;
endingColor[2] = 0;
i = 0, j = 0;
while (i <= num) {
hilite = "#";
while (j < 3) {
hilite += convert[startingColor[j]];
hilite += 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 = new Image();
preImages.src = yourImages;
loaded = 0;
cover = 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 && preImages.complete) {
loaded = 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>
<center>
<font face="Verdana, Arial, Helvetica" size="2" color="#FFFFFF"><center>Preloading Images ..</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)">Skip Preloading</a></small></p></font>')
loadImages();
// end hiding -->
</script>
</center>
<p>
<p>
<form>
<input type="button" value="Quelltext" onclick='window.location = "view-source:" + window.location.href'>
</form>
<p>
<br><hr align="center" size="1" width="50%">
<center>
meine eMail: <a href="mailto:mo@webaid.de" class=linkint>mo@webaid.de</a><br>
meine Homepage: <a href="http://www.webaid.de/js" target="_top" class=linkint>http://www.mywebaid.de</a><br>
</center>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" src="../ms.js">
<!--
//-->
</SCRIPT>
Zunächt einmal ein kleiner Hinweis: Ich bin der totale Noob im Webdesign... also bitte nicht lachen
Jetzt zu meinem Problem:
Ich habe mir auf der HP von Michael Mailer, das Preload script geladen und in den Head-Bereich meiner HP eingefügt.
Das Script läd die Bilder wie gewünscht, aber der Preloader hängt ganz oben im Browser.
Ich hätte den Preloader aber gerne in der Mitte des Browsers!
wie stelle ich das an?
PS: wer das script nicht kennt hier ist es:
</head>
<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("gfx/banner_468_1.gif", "gfx/banner_468_2.gif") // Fill this array with the images you wish to preload
var locationAfterPreload = "popup.php" // 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 = 10 // 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] = "f"
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] = "c"
endingColor[1] = "0"
endingColor[2] = "0"
// 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 = startingColor.toLowerCase();
endingColor = endingColor.toLowerCase();
startingColor = eval(startingColor);
endingColor = eval(endingColor);
diff = (endingColor-startingColor)/num;
ones = Math.floor(diff);
sixteens = Math.round((diff - ones)*15);
}
endingColor[0] = 0;
endingColor[1] = 0;
endingColor[2] = 0;
i = 0, j = 0;
while (i <= num) {
hilite = "#";
while (j < 3) {
hilite += convert[startingColor[j]];
hilite += 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 = new Image();
preImages.src = yourImages;
loaded = 0;
cover = 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 && preImages.complete) {
loaded = 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>
<center>
<font face="Verdana, Arial, Helvetica" size="2" color="#FFFFFF"><center>Preloading Images ..</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)">Skip Preloading</a></small></p></font>')
loadImages();
// end hiding -->
</script>
</center>
<p>
<p>
<form>
<input type="button" value="Quelltext" onclick='window.location = "view-source:" + window.location.href'>
</form>
<p>
<br><hr align="center" size="1" width="50%">
<center>
meine eMail: <a href="mailto:mo@webaid.de" class=linkint>mo@webaid.de</a><br>
meine Homepage: <a href="http://www.webaid.de/js" target="_top" class=linkint>http://www.mywebaid.de</a><br>
</center>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" src="../ms.js">
<!--
//-->
</SCRIPT>