top.frames[1].location.href not working: fetch frame name during runtime

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Revathi Balakrishnan
    New Member
    • Jun 2008
    • 40

    #1

    top.frames[1].location.href not working: fetch frame name during runtime

    Hi All
    My" Frame .html " page is divided in to header and client frames and in my client frame i am loading "client.htm l" page, and this client .html is divided in to multiple frames,

    when i click any on link in the client.html,it should load the url of the link in the client frame, ir respective of the frame in which the link resides in the client.html,

    hence i used

    top.frames[1].location.href= link_url;
    this is not working

    But if i use
    top.frames["framename"]=link_url
    it works fine

    i don want to use the name, can any one help me please?
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    According to w3schools, it would return references of the named frame only. So if the second frame of your page doesn't have any name, it won't be returned with frames[1].

    Comment

    • Revathi Balakrishnan
      New Member
      • Jun 2008
      • 40

      #3
      i have named my frame, as CLIENT eventhough if i use
      top.frames[1].location.href= link_url; i am getting object expected error, and i checked window.frames.l ength before the line top.frames[1].location.href usig alert, and that retured 1, but i expected more than 2, since my

      My" Frame .html " page is divided in to header and client frames and in my client frame i am loading "client.htm l" page, and this client .html is divided in to multiple frames,

      i don understand what is happening, i am expecting your advice :)

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Post your HTML frame code. Also, have a look at this link.

        Comment

        • Revathi Balakrishnan
          New Member
          • Jun 2008
          • 40

          #5
          Hi Guys, I'm back , sorry was pulled in to some other issue,

          And this issue was yet unresolved.

          top.frames[1].location.href= page_url; is still not working,

          But i have found one thing, it works in IE(version 6), it is not working in fire fox only.

          Can any one hep me.


          i am not able to paste the entire code, due to some safty measures :(

          Comment

          • Revathi Balakrishnan
            New Member
            • Jun 2008
            • 40

            #6
            Hi all
            In the below syntax,
            top.frames["framename"].location.href

            i don want to hard code the frame name, Instead is there any way in which i can dynamically fetch the name of the frame in a html file using javascript?

            Any of ur advise would be much helpful to me

            Comment

            • Revathi Balakrishnan
              New Member
              • Jun 2008
              • 40

              #7
              How do i fetch the name of the frame during run time

              Hi all
              the below syntax,

              top.frames[1].location.href not working is not working in fire fox

              but the below works
              top.frames["framename"].location.href


              i don want to hard code the frame name, Instead is there any way with which i can dynamically fetch the name of the frame in a html file using javascript?

              Any of ur advise would be much helpful to me

              Comment

              • Brosert
                New Member
                • Jul 2008
                • 57

                #8
                Originally posted by Revathi Balakrishnan
                top.frames[1].location.href not working is not working in fire fox
                Have you tried
                [Code=HTML]top.frames[0].location.href [/CODE]

                Comment

                • Revathi Balakrishnan
                  New Member
                  • Jun 2008
                  • 40

                  #9
                  hi
                  Thanks for the reply, I tried top.frames[0].location.href that also does not work

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    Just post some relevant code, e.g. how you've declared the frame tag, where and how you're calling the code.

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      #11
                      Merged threads. Please do not double post your questions.

                      Comment

                      Working...