hello ppl,
I am new to java scripr and need some help with this
preload images script.
The problem is that I use this script for loading
many pics on different html pages. So, I keep
pasting it in each page....... now this is redundent stuff,
So i was hoping to make it in to a single .js file and
send the images as parameters from with in the page.
But as i have problems with arrays i couldnt.
So can anyone solve my problem, make the script
in to a dynamic one which accepts the images as
parameters.
Here is the part of the script..
"../4.jpg",
"../5.jpg",
"../6.jpg");
function transfer(param) {
location.href = "mainboard.html"; // URL of second page goes here **
}
function done() {
if (vers < 1.1)
transfer();
else
commence_loading();
}
function commence_loading() {
for (g=0;g= 1.1) {
blue = new Image();
blue.src = "../../images/scroll/blue.gif";
black = new Image();
black.src = "../../images/scroll/white.gif";
}
var loaded = new initArray(0);
for (h=0;h
Comments
Basically, you want to create a function in the included file, that accepts one parameter- the image to preload. This will preload a single image. Then, set up a for loop that calls it with each image you want preloaded.
This is a script from js-examples. It preloads a set of images, displays one, then you can click to display the rest one by one.
HTH,
Lillu
#photos {
position:absolute;
left:245px;
top:311px;
width:50;
height:50;
z-index:5;
background-color: #FFFFFF;
layer-background-color: #FFFFFF;
border: 1px none #000000;
}
: hello ppl,
:
: I am new to java scripr and need some help with this
: preload images script.
:
: The problem is that I use this script for loading
: many pics on different html pages. So, I keep
: pasting it in each page....... now this is redundent stuff,
:
: So i was hoping to make it in to a single .js file and
: send the images as parameters from with in the page.
:
: But as i have problems with arrays i couldnt.
: So can anyone solve my problem, make the script
: in to a dynamic one which accepts the images as
: parameters.
:
: Here is the part of the script..
:
:
:
:
:
:
:
:
:
: "../4.jpg",
: "../5.jpg",
: "../6.jpg");
:
:
: function transfer(param) {
: location.href = "mainboard.html"; // URL of second page goes here **
: }
:
: function done() {
: if (vers < 1.1)
: transfer();
: else
: commence_loading();
: }
:
: function commence_loading() {
: for (g=0;g= 1.1) {
: blue = new Image();
: blue.src = "../../images/scroll/blue.gif";
: black = new Image();
: black.src = "../../images/scroll/white.gif";
: }
:
: var loaded = new initArray(0);
: for (h=0;h
:
:
: