Wo liegt hier der Fehler? Er zeigt mir die Leiste preload Leiste nicht an, manchmal geht er zur nächsten Seitemanchmal bleibt er stecken.
Preload.js:
Code:
<script language="JavaScript" src="preload.js" type="text/javascript"></script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- a:link { color: #000000; text-decoration: none; } a:visited { text-decoration: none; color: #000000; } a:hover { text-decoration: underline; } a:active { text-decoration: none; } .style1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; } .style3 {font-size: small} --> </style></head> <body> <div align="center"> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><table width="400" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000"> <tr> <td width="400" height="100" align="center" bgcolor="#DADADA"> <center> <span class="style1">Bitte einen Moment Geduld, die Seite wird aufgebaut...</span><br> <br> <span class="style1">0%</span> <script language="JavaScript1.1"> <!-- if (document.images) { var preloadBar = '' for (i = 0; i < yourImages.length-1; i++) { preloadBar += '<img src="' + dots[0].src + '" width="' + coverage + '" height="' + heightOfPreloadBar + '" name="img' + i + '" align="absmiddle">' } preloadBar += '<img src="' + dots[0].src + '" width="' + (leftOverWidth+coverage) + '" height="' + heightOfPreloadBar + '" name="img' + (yourImages.length-1) + '" align="absmiddle">' document.write(preloadBar) loadImages() } document.write('<span class="style1">100%</span><br><br><a href="javascript:window.location=locationAfterPreload"><span class="style1">Überspringen</span></a>') //--> </script>
Preload.js:
Code:
var locationAfterPreload = "main.php?action=news" var lengthOfPreloadBar = 180 var heightOfPreloadBar = 10 var yourImages = new Array( "hintergrund.gif", "strich1.gif", "strich2.gif", ) if (document.images) { var dots = new Array() dots[0] = new Image(1,1) dots[0].src = "preload_1.gif" dots[1] = new Image(1,1) dots[1].src = "preload_2.gif" var preImages = new Array(),coverage = Math.floor(lengthOfPreloadBar/yourImages.length),currCount = 0 var loaded = new Array(),i,covered,timerID var leftOverWidth = lengthOfPreloadBar%coverage } function loadImages() { for (i = 0; i < yourImages.length; i++) { preImages[i] = new Image() preImages[i].src = yourImages[i] } for (i = 0; i < preImages.length; i++) { loaded[i] = false } checkLoad() } function checkLoad() { if (currCount == preImages.length) { location.replace(locationAfterPreload) return } for (i = 0; i <= preImages.length; i++) { if (loaded[i] == false && preImages[i].complete) { loaded[i] = true eval("document.img" + currCount + ".src=dots[1].src") currCount++ } } timerID = setTimeout("checkLoad()",10) }
Kommentar