PDA

View Full Version : URGENTwhy is this script not working??


SpeedFreak
10-25-2002, 09:37 AM
here is the page: http://blueshiftdesigns.clook.net/loading.html

i dont know why it isnt working - it should bring up a loading bar, load some images and then go to a new page but it isnt :(

here is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Loading BlueShift Designs....</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
<!-- begin hiding

/*
Preload Image With Update Bar Script (By Marcin Wojtowicz [one_spook@hotmail.com])
Submitted to and permission granted to Dynamicdrive.com to feature script in it's archive
For full source code to this script and 100's more, visit http://dynamicdrive.com
*/

// You may modify the following:
var locationAfterPreload = "site.php" // URL of the page after preload finishes
var lengthOfPreloadBar = 170 // Length of preload bar (in pixels)
var heightOfPreloadBar = 20 // Height of preload bar (in pixels)
// Put the URLs of images that you want to preload below (as many as you want)
var yourImages = new Array("http://www.blueshiftdesigns.clook.net/images/template/bootom_bar.jpg","http://www.blueshiftdesigns.clook.net/images/template/box_3d.jpg","http://www.blueshiftdesigns.clook.net/images/template/box_middle.jpg"."http://www.blueshiftdesigns.clook.net/images/template/content_bottom.jpg","http://www.blueshiftdesigns.clook.net/images/template/content_bottom_tile.jpg","http://www.blueshiftdesigns.clook.net/images/template/content_box_end.jpg","http://www.blueshiftdesigns.clook.net/images/template/content_box_top.jpg","http://www.blueshiftdesigns.clook.net/images/template/content_box_top_right.jpg","http://www.blueshiftdesigns.clook.net/images/template/contentbg.jpg","http://www.blueshiftdesigns.clook.net/images/template/left_bg.jpg","http://www.blueshiftdesigns.clook.net/images/template/logo.jpg","http://www.blueshiftdesigns.clook.net/images/template/logo_right.jpg","http://www.blueshiftdesigns.clook.net/images/template/logo_top.jpg","http://www.blueshiftdesigns.clook.net/images/template/logo_top_right.jpg","http://www.blueshiftdesigns.clook.net/images/template/menu_bg.jpg","http://www.blueshiftdesigns.clook.net/images/template/middle_bg.jpg","http://www.blueshiftdesigns.clook.net/images/template/slogan.jpg","http://www.blueshiftdesigns.clook.net/images/template/top_bar.jpg","http://www.blueshiftdesigns.clook.net/images/template/under_logo_right.jpg")

// Do not modify anything beyond this point!
if (document.images) {
var dots = new Array()
dots[0] = new Image(1,1)
dots[0].src = "black.gif" // default preloadbar color (note: You can substitute it with your image, but it has to be 1x1 size)
dots[1] = new Image(1,1)
dots[1].src = "blue.gif" // color of bar as preloading progresses (same note as above)
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)
}
// end hiding -->
</script>
</head>

<body bgcolor="02396D" text="#FFFFFF" link="#FFCC00" vlink="#FFCC00" alink="#FFCC00" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br><Br><Br>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td background="loading.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="http://www.blueshiftdesigns.clook.net/images/template/spacer.gif" width="1" height="45"></td>
</tr>
<tr>
<td width="10"><table width="401" border="0" cellspacing="0">
<tr>
<td width="1"><img src="http://www.blueshiftdesigns.clook.net/images/template/spacer.gif" width="1" height="55"></td>
<td width="19">&nbsp;</td>
<td width="263" valign="top">
<script>
<!-- begin hiding
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('<p><small><a href="javascript:window.location=locationAfterPreload">Skip Preloading</a> &nbsp;|</small></p>')
// end hiding -->
</script>
</td>
<td width="100">&nbsp;</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>


plz help me :(

cheers

jolietjake
10-25-2002, 09:59 AM
Ehm, Er... Perhaps no but... You tried to put <script language="javascript" > on your javascript tags?

glenngv
10-25-2002, 10:08 AM
jolietjake, javascript is the default scripting language. :)

SpeedFreak, change the following line in checkLoad() function:

for (i = 0; i <= preImages.length; i++) {

to:

for (i = 0; i < preImages.length; i++) {

SpeedFreak
10-25-2002, 12:29 PM
no joy :(

its sposed to load the images and then go to 'site.php' however the loading bar never appears?!?!?

SpeedFreak
10-25-2002, 01:03 PM
FIXED :)