girlinterrupted24
Programmer
Hi guys,
This is a function I use to update image SRC's.... BUT with 20 pictures its so long... NOT only that I would like to basically say IF there is a value passed into the function for say pic1 and so on THEN update the SRC, IF there is no value passed for that one, then dont do anything with that pic num...
so sort of like this... but i dont know how to do it in javascript - i managed to my original function... but when it comes to something more complex like this im a bit lost
for i = 1 to 20
if pic1 is filled then
document.images["pic1"].src = "../images/property" + pic1 + tmp;
next
CURRENT FUNCTION
function Refresher(pic1,pic2,pic3,pic4,pic5,pic6,pic7,pic8,pic9,pic10,pic11,pic12,pic13,pic14,pic15,pic16,pic17,pic18,pic19,pic20) {
tmp = new Date();
tmp = "?" + tmp.getTime();
document.images["pic1"].src = "../images/property" + pic1 + tmp;
document.images["pic2"].src = "../images/property" + pic2 + tmp;
document.images["pic3"].src = "../images/property" + pic3 + tmp;
document.images["pic4"].src = "../images/property" + pic4 + tmp;
document.images["pic5"].src = "../images/property" + pic5 + tmp;
document.images["pic6"].src = "../images/property" + pic6 + tmp;
}
is this possible? many thanks your help
This is a function I use to update image SRC's.... BUT with 20 pictures its so long... NOT only that I would like to basically say IF there is a value passed into the function for say pic1 and so on THEN update the SRC, IF there is no value passed for that one, then dont do anything with that pic num...
so sort of like this... but i dont know how to do it in javascript - i managed to my original function... but when it comes to something more complex like this im a bit lost
for i = 1 to 20
if pic1 is filled then
document.images["pic1"].src = "../images/property" + pic1 + tmp;
next
CURRENT FUNCTION
function Refresher(pic1,pic2,pic3,pic4,pic5,pic6,pic7,pic8,pic9,pic10,pic11,pic12,pic13,pic14,pic15,pic16,pic17,pic18,pic19,pic20) {
tmp = new Date();
tmp = "?" + tmp.getTime();
document.images["pic1"].src = "../images/property" + pic1 + tmp;
document.images["pic2"].src = "../images/property" + pic2 + tmp;
document.images["pic3"].src = "../images/property" + pic3 + tmp;
document.images["pic4"].src = "../images/property" + pic4 + tmp;
document.images["pic5"].src = "../images/property" + pic5 + tmp;
document.images["pic6"].src = "../images/property" + pic6 + tmp;
}
is this possible? many thanks your help