Stig
07-13-2007, 02:12 PM
I have the simplest js function to change an image on a page -
function swapImage() {
this.document.IMG1.src = 'propertyimages/PWI07071360/slides/image1.jpg'
return(false);
}
which works perfectly. The problem is I need the path to the image to contain a php variable. I tried this
function swapImage(thisImage) {
this.document.IMG1.src = 'propertyimages/' + thisImage + '/image2.jpg'
return(false);
}
Where thisImage is passed as the following - PWI07071360, but it's not working at all. Am I building the string incorrectly in the function?
I also tried this -
function swapImage(thisImage) {
newImageName = 'propertyimages/' + thisImage + '/slides/image2.jpg';
this.document.IMG1.src = newImageName
return(false);
}
I'd welcome any help or suggestions please.
function swapImage() {
this.document.IMG1.src = 'propertyimages/PWI07071360/slides/image1.jpg'
return(false);
}
which works perfectly. The problem is I need the path to the image to contain a php variable. I tried this
function swapImage(thisImage) {
this.document.IMG1.src = 'propertyimages/' + thisImage + '/image2.jpg'
return(false);
}
Where thisImage is passed as the following - PWI07071360, but it's not working at all. Am I building the string incorrectly in the function?
I also tried this -
function swapImage(thisImage) {
newImageName = 'propertyimages/' + thisImage + '/slides/image2.jpg';
this.document.IMG1.src = newImageName
return(false);
}
I'd welcome any help or suggestions please.