kippo
07-07-2003, 06:43 AM
This function is called with Onload in the body tag of my code, this is so i can pass a vital bit of data to 'dir'.
'dir' is a number refering to a db id attribute, which matches up with a directory name where 8 images of that db item are stored.
Eveything works fine if i place a number where the ???'s are below, but obviouly this is no good as i get the same images for each db item. I need this ??? to be the value in 'dir'?
How do i get the directory at ??? to change to the vaule held in 'dir'?
function preload_img(dir)
{
pic1=new Image(400,400);
pic1.src="images/???/01.jpg";
pic2=new Image(400,400);
pic2.src="images/???/02.jpg";
pic3=new Image(400,400);
pic3.src="images/???/03.jpg";
pic4=new Image(400,400);
pic4.src="images/???/04.jpg";
pic5=new Image(400,400);
pic5.src="images/???/05.jpg";
pic6=new Image(400,400);
pic6.src="images/???/06.jpg";
pic7=new Image(400,400);
pic7.src="images/???/07.jpg";
pic8=new Image(400,400);
pic8.src="images/???/08.jpg";
}
really appreciate any advice! i just can't get anything to work, although i am quiet new to js.
Cheers
'dir' is a number refering to a db id attribute, which matches up with a directory name where 8 images of that db item are stored.
Eveything works fine if i place a number where the ???'s are below, but obviouly this is no good as i get the same images for each db item. I need this ??? to be the value in 'dir'?
How do i get the directory at ??? to change to the vaule held in 'dir'?
function preload_img(dir)
{
pic1=new Image(400,400);
pic1.src="images/???/01.jpg";
pic2=new Image(400,400);
pic2.src="images/???/02.jpg";
pic3=new Image(400,400);
pic3.src="images/???/03.jpg";
pic4=new Image(400,400);
pic4.src="images/???/04.jpg";
pic5=new Image(400,400);
pic5.src="images/???/05.jpg";
pic6=new Image(400,400);
pic6.src="images/???/06.jpg";
pic7=new Image(400,400);
pic7.src="images/???/07.jpg";
pic8=new Image(400,400);
pic8.src="images/???/08.jpg";
}
really appreciate any advice! i just can't get anything to work, although i am quiet new to js.
Cheers