How to display the page from child window to parent frame.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • susinthaa
    New Member
    • Jun 2007
    • 30

    How to display the page from child window to parent frame.

    Hi,

    I am new to javascript.
    This is my problem description.
    Actually I have 3 pages.
    In the first page I have 2 frames.
    In the first page(first) from one of the frame(first), I have a link to another page(second).
    From the second, I have opened new page(third).
    these and all i did in html.
    But the problem is from the third page , I have to dispaly some contents to the
    second frame of the first page using the javascript function and on_click event.
    The code as follows:
    The Code for first page:

    [HTML]<html>
    <head>
    </head>

    <frameset rows="50%,50%">


    <frame src="D:\frame_b .html" name="first">
    <frame src="D:\frame_c .html" name="second">

    </frameset>

    </html>

    The code for second page:
    <html>
    <head>
    </head>
    <body>
    this is frame_b
    <a href="D:\link.h tml"target="_bl ank">click here</a>
    </body>
    </html>

    Code for third page:
    <html>
    <head>
    </head>
    <body>
    this is the new page open in new window
    <a href="D:\sample .html"target="_ blank">click here</a>
    </body>
    </html>
    Code for fourth page:
    <html>
    <head>
    </head>
    <body>
    this is sample html page
    <script>
    function testing()
    {
    window.parent.s econd.location= "D:\frame_c.htm l"

    }
    </script>
    <a href="#" onClick="javasc ript:testing(); return false">Say Hi</a>

    </body>
    </html>

    The code for the text display in secod frame:
    <html>
    <head>
    </head>
    <body>
    this is frame_c

    </body>
    </html>[/HTML]

    Where I am doing mistake ? please help me
    Attached Files
    Last edited by gits; Oct 12 '07, 08:49 AM. Reason: added code tags
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    try this ..............

    [code=javascript]
    window.parent.s econd.location. href="D:\frame_ c.html"
    [/code]

    Debasis Jana

    Comment

    • susinthaa
      New Member
      • Jun 2007
      • 30

      #3
      Originally posted by dmjpro
      try this ..............

      [code=javascript]
      window.parent.s econd.location. href="D:\frame_ c.html"
      [/code]

      Debasis Jana
      Hi Debasis,

      Thank you.
      But I got the error in my last probgram
      Error :

      I got the error in line 9 and in character 15.
      window.parent.s econd.location is null or not an object.

      please help me....

      Thanks and regards,
      Susi

      Comment

      • dmjpro
        Top Contributor
        • Jan 2007
        • 2476

        #4
        Originally posted by susinthaa
        Hi Debasis,

        Thank you.
        But I got the error in my last probgram
        Error :

        I got the error in line 9 and in character 15.
        window.parent.s econd.location is null or not an object.

        please help me....

        Thanks and regards,
        Susi
        What is second?
        I think it is a frame....named second.
        then try it ..........

        [code=javascript]
        window.parent.f rames["second"].location.href = "...";
        [/code]

        Debasis Jana

        Comment

        • susinthaa
          New Member
          • Jun 2007
          • 30

          #5
          Originally posted by dmjpro
          What is second?
          I think it is a frame....named second.
          then try it ..........

          [code=javascript]
          window.parent.f rames["second"].location.href = "...";
          [/code]

          Debasis Jana
          Hi Debasis,

          Ya its one of the frame in the first page.

          Thank you,
          Susi

          Comment

          • dmjpro
            Top Contributor
            • Jan 2007
            • 2476

            #6
            Originally posted by susinthaa
            Hi Debasis,

            Ya its one of the frame in the first page.

            Thank you,
            Susi
            Now what is happening??
            The frame is first, second or what?

            Debasis Jana.

            Comment

            • susinthaa
              New Member
              • Jun 2007
              • 30

              #7
              Originally posted by dmjpro
              Now what is happening??
              The frame is first, second or what?

              Debasis Jana.
              Hi Debasis,

              Its second frame.But now also I am getting the same error.
              If the parent means , is it identify the direct page only or the first page?

              Thanks and Regards,
              Susi

              Comment

              • susinthaa
                New Member
                • Jun 2007
                • 30

                #8
                Hi,

                I tried the following in the last file.Its working fine.But throws javascript error.

                [HTML]<html>
                <head>

                </head>
                <body>
                this is sample html page
                <a href="D:\frame_ c.html" target="second" onClick="parent .frames[second].location.href= "D:\frame_c.htm l" return false;">Say Hi</a>
                </body>
                </html>[/HTML]

                Thanks and Regards,

                Susintha
                Last edited by gits; Oct 12 '07, 12:01 PM. Reason: added code tags

                Comment

                • gits
                  Recognized Expert Moderator Expert
                  • May 2007
                  • 5390

                  #9
                  since 'second' is a value of an attribute its a string ... so use:

                  [CODE=javascript]parent.frames['second'].location.href= 'D:\\frame_c.ht ml';[/CODE]
                  kind regards

                  ps: note ... you cannot use the double quotes inside the onclick statement, simply use single quotes or escape the double ones

                  Comment

                  Working...