Jumping in a frame using Javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • compassSoftware@gmail.com

    Jumping in a frame using Javascript

    Hi,

    I have two horizontal frames, one on top of the other.

    The top frame is an image map of a street with property boundary's on
    it.

    The bottom frame is a table with each row of the table holds details
    about a perticular property from the image map above.

    The user clicks on the image map in the top frame and the corresponding
    row in the table is highlighted in the bottom frame.

    The table is very long and the rows continue below the visable canvas.

    What i need is a way to jump to the row when it is highlighted so that
    it displays no matter where in the table it is located.

    Is it possible to jump in a frame or page using Javascript?

  • compassSoftware@gmail.com

    #2
    Re: Jumping in a frame using Javascript

    Here is the script I am using (just encase it helps someone get an idea
    of what I mean).
    "passdata" is the row id being passed in from the top frame. The row id
    is used to find and highlight the corresponding row. What I really need
    to do is to be able to use the row id to jump to a particular area of
    the frame.

    <script type="text/javascript">
    <!--
    var passdata = 1;
    var oldpassdata = 1;

    function Start() {
    if(oldpassdata != passdata)
    ShowPass();

    id1 = setTimeout("Sta rt();", 100); // check value every .1 sec.
    }

    function ShowPass() {
    highlightrow(pa ssdata);
    oldpassdata = passdata;
    }

    function highlightrow(n) {
    clearallrows()
    document.getEle mentById(n).sty le.backgroundCo lor='#FFAABB';
    }

    function clearallrows(){
    if (oldpassdata ==1)
    oldpassdata = passdata;

    document.getEle mentById(oldpas sdata).style.ba ckgroundColor=' #FFFFFF';

    }
    // -->
    </script>

    Comment

    • c.anandkumar@gmail.com

      #3
      Re: Jumping in a frame using Javascript

      Use anchors. For each row, have an anchor close to it with a unique
      name. You can have something like rown. So for each row, have an anchor
      text near to it with name/id = rown. You can then jump to that row by
      setting the location property of the bottom frame to the anchor name.
      sthg like this in the highlightrow (n) function :
      eval ("bottomFrameNa me.location='ro w" + n + "'");

      Thanks

      Anand.

      Comment

      • compassSoftware@gmail.com

        #4
        Re: Jumping in a frame using Javascript

        Thank you for that! That sounds like just what I need.

        Comment

        • Evertjan.

          #5
          Re: Jumping in a frame using Javascript

          c.anandkumar@gm ail.com wrote on 07 mrt 2005 in comp.lang.javas cript:
          [color=blue]
          > eval ("bottomFrameNa me.location='ro w" + n + "'");
          >[/color]

          why the evil eval?

          bottomFrameName .location='row' + n

          wouldn't that work?

          --
          Evertjan.
          The Netherlands.
          (Replace all crosses with dots in my emailaddress)

          Comment

          • c.anandkumar@gmail.com

            #6
            Re: Jumping in a frame using Javascript

            Yeah. Thanks

            Comment

            • compassSoftware@gmail.com

              #7
              Re: Jumping in a frame using Javascript

              I used the bottomFrame2.lo caton='row' + n; and when i do I get
              bottomFrame2 is undefined.


              I then tried to place the document object before bottomFrame2 and I get

              Document.bottom Frame2 is null or not an object error.

              Any ideas?

              Comment

              • compassSoftware@gmail.com

                #8
                Re: Jumping in a frame using Javascript

                I used document.locati on='row' + n and I get "The page cannot be found"
                error message in the bottom frame.

                Comment

                • Evertjan.

                  #9
                  Re: Jumping in a frame using Javascript

                  wrote on 08 mrt 2005 in comp.lang.javas cript:
                  [color=blue]
                  > I used the bottomFrame2.lo caton='row' + n; and when i do I get
                  > bottomFrame2 is undefined.
                  >[/color]

                  [please ALWAYS quote. Usenet is not email, and others want to read too]

                  bottomFrame2.lo caton='row' + n;

                  locaton ?????????????

                  --
                  Evertjan.
                  The Netherlands.
                  (Replace all crosses with dots in my emailaddress)

                  Comment

                  • compassSoftware@gmail.com

                    #10
                    Re: Jumping in a frame using Javascript

                    locaton
                    I misspelled while typing in usernet, "location" is spelled properly in
                    my code.

                    Here is the code if it helps.
                    function highlightrow(n) {
                    clearallrows()
                    document.getEle mentById(n).sty le.backgroundCo lor='#FFAABB';
                    bottomFrame2.lo cation='row' + n;
                    }

                    Sorry but I am unfamilar with quoting. I use google (I thought everyone
                    did) and I can see all related post.

                    If my [quote] hack from above works I will try to use it more.

                    Comment

                    • c.anandkumar@gmail.com

                      #11
                      Re: Jumping in a frame using Javascript

                      you should use #rown. not just rown. using eval works for me fine.

                      Comment

                      • compassSoftware@gmail.com

                        #12
                        Re: Jumping in a frame using Javascript

                        I am using eval and I have put the # in. However I am still getting
                        bottomFrame2 is undefined.

                        So I replaced bottomFrame2 with document as the scrip is in the head of
                        the page that I want to jump around in.
                        eg
                        function highlightrow(n) {
                        clearallrows()
                        document.getEle mentById(n).sty le.backgroundCo lor='#FFAABB';
                        eval ("document.loca tion='#row" + n + "'");
                        }

                        I don't recieve any errors now however I'm not jumping either.

                        I have check the code and the anchor tag is there. It is in a table
                        outside of each row. eg
                        <a name=row140></a><tr id=140><td>140</td></tr>

                        Comment

                        • compassSoftware@gmail.com

                          #13
                          Re: Jumping in a frame using Javascript

                          Ok progress, It works so long as the anchors are outside of the table.

                          Problem is the table is generated pragmatically using asp.net. It is
                          built with a dataset populated with the property information from my
                          database. I loop through the dataset and create a new row in my table
                          for each for in the dataset.

                          I will try to create each row as a single table and put the anchor
                          after the table (what a hack!) There has to be a better solution.

                          Comment

                          • Evertjan.

                            #14
                            Re: Jumping in a frame using Javascript

                            wrote on 08 mrt 2005 in comp.lang.javas cript:[color=blue]
                            > Sorry but I am unfamilar with quoting. I use google (I thought everyone
                            > did) and I can see all related post.[/color]

                            Usenet is over 20 years old, even much older than the web.
                            No, Google is only used for usenet by a minority.
                            Most people use a dedicated news-reader.

                            Read up on Usenet and Usenet netiquette.

                            <http://www.google.com/search?q=Usenet +netiquette+quo ting>
                            20,600 hits

                            --
                            Evertjan.
                            The Netherlands.
                            (Replace all crosses with dots in my emailaddress)

                            Comment

                            • Dr John Stockton

                              #15
                              Re: Jumping in a frame using Javascript

                              JRS: In article <Xns961369310FD 00eejj99@194.10 9.133.29>, dated Tue, 8
                              Mar 2005 09:20:23, seen in news:comp.lang. javascript, Evertjan.
                              <exjxw.hannivoo rt@interxnl.net > posted :[color=blue]
                              > wrote on 08 mrt 2005 in comp.lang.javas cript:
                              >[color=green]
                              >> I[/color][/color]
                              [color=blue]
                              >[please ALWAYS quote. Usenet is not email, and others want to read too][/color]

                              I see no point in telling Googlers what to do without telling them how
                              to do it; be constructive, not just critical.

                              Keith Thompson wrote :-
                              If you want to post a followup via groups.google.c om, don't use the
                              "Reply" link at the bottom of the article. Click on "show options" at
                              the top of the article, then click on the "Reply" at the bottom of the
                              article headers.

                              Does new Google now allow indentation?

                              What's "mrt" ?!?

                              --
                              © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME ©
                              Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
                              Web <URL:http://www.merlyn.demo n.co.uk/news-use.htm> : about usage of News.
                              No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

                              Comment

                              Working...