tripwater
01-12-2007, 05:36 PM
Hello, I am a php programmer and so I am not the best with JS. With that said, I have a page with an iframe.
The iframe holds thumbnails. When you click on a thumbnail, I would like for it to change the image on the parent page. So my issue is that I do not know how to set the img src inside my function. Here is what I have
function SetLargeImage(SRC)
{
var idsplit=SRC.split(/_/);
var imageid=idsplit[1];
//alert(imageid);
parent.document.getElementById('M_1').src='http://www.mysite.net/gallery/medium/M_\'+imageid+\'.jpg';
}
here is the call. This is the one of the thumbnails. In the parent page, the img tag that I am trying to set the source to has the id of M_1
<img id=\"T_".$row["ImageID"]."\" src=\"http://www.mysite.net/gallery/thumbs/T_".$row["ImageID"].".jpg\" onclick=\"SetLargeImage(this.id);\" >
Here is the img tag on my parent page
<img id="M_1" name="M1" border="0" />
THank you for any help with this
The iframe holds thumbnails. When you click on a thumbnail, I would like for it to change the image on the parent page. So my issue is that I do not know how to set the img src inside my function. Here is what I have
function SetLargeImage(SRC)
{
var idsplit=SRC.split(/_/);
var imageid=idsplit[1];
//alert(imageid);
parent.document.getElementById('M_1').src='http://www.mysite.net/gallery/medium/M_\'+imageid+\'.jpg';
}
here is the call. This is the one of the thumbnails. In the parent page, the img tag that I am trying to set the source to has the id of M_1
<img id=\"T_".$row["ImageID"]."\" src=\"http://www.mysite.net/gallery/thumbs/T_".$row["ImageID"].".jpg\" onclick=\"SetLargeImage(this.id);\" >
Here is the img tag on my parent page
<img id="M_1" name="M1" border="0" />
THank you for any help with this