Results 1 to 2 of 2

Thread: pass src to iframe present in one frame from inframe present in other frame

  1. #1
    Join Date
    Jul 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default pass src to iframe present in one frame from inframe present in other frame

    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.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Instead of using id's on the iframes, make it their names (ex: name="iframe2"). Then, this might work:

    parent.Right.iframe2.src=vLink
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •