Click to See Complete Forum and Search --> : Changin images in different frames
bemar
02-20-2003, 12:35 PM
Hi @ all,
how can I change a pic in frame1 from frame2?
I have frame1 "top" und frame2 "main". I
want to change the source of a pic in frame "top"
from the code in frame "main".
I tried this code
window.top.images[3].src="pictures/indicator_event.gif";
but it don't work.
Thank you for your help.
bye
ben
DaveSW
02-20-2003, 12:48 PM
Would a hyperlink be better? You can specify the target frame in the hyperlink code
<A HREF="../Conveyors/Index.htm"etc TARGET="Frame">
(i've cut the mouseover image bits out of the middle)
Is this what you mean?
Dave
khalidali63
02-20-2003, 12:59 PM
in the frame where the image is give the image an id atribute with a value.say
id = "image1"
then in the frame where you want to change the image from, use a function like this
<script type="text/javascript">
function changeImage(){
var img = parent.frames[0].document.getElementById("image1");
/the frames[0] index points the first frame in a frameset,you mau have to insert to correct frame index or name in here.
img.setAttribute("src","../images/flake.gif")
//change the source path accordingly.
}
</script>
</head>
<body>
<a href="javascript:changeImage();">Change image in top frame</a>
cheers
Khalid
bemar
02-20-2003, 01:55 PM
:cool: Cool. Thats it.
Thank you very much
Ben :)