PDA

View Full Version : pass src to iframe present in one frame from inframe present in other frame



chitra
07-20-2005, 06:43 AM
I have 2 frames namely left and right frames.
In left frame I have one iframe control i.e. iframe1
In right frame I have other iframe control i.e. iframe2
Now in iframe1 i have called one a.jsp file.
From this file,i want to change src of iframe2 present in right frame.How to do that.Please find my code as follows

Home .jsp consists of
<frameset frameborder=0 style="border-width:thin;border-color:black" cols="20%,80%" name="frame1">
<frame name="left" src="Left.jsp" frameborder=0>
<frame name="Right" src="RightImageSearch.jsp">
</frameset>


Left.jsp consists of

<html>
<iframe id="iframe1" scroll=no src="a.jsp" width="165" height="370" ></iframe>
</html>

Right.jsp consists of

<html>
<iframe id="iframe2" scroll=no width="165" height="370" ></iframe>
</html>



from in a.jsp I am trying to change iframe2 of right frame like

parent.document.getElementById("iframe2 ").src=vLink

But it is not working.Please let me know how to changes src of iframe2.

Thanks in adv.

jscheuer1
07-20-2005, 09:37 AM
Instead of using id's on the iframes, make it their names (ex: name="iframe2"). Then, this might work:

parent.Right.iframe2.src=vLink