passing values between html pages using frames

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sindhu
    New Member
    • Oct 2006
    • 53

    passing values between html pages using frames

    hello there,
    as the title ggoes, i want to pass values btn html pages in the same frame.
    i've two framesets, top frmeset and bottom set, in the bottom frameset there are three frames, frame1,frame2 ,frame3.
    i want to load different page in frame3 by using buttons in frame2. and once frame3 is loaded based on the radio button selection i want to load another page in the same frame i.e. frame3 and pass the value of radio button to a textbox in that newly loaded page.

    please some one help me
    thanks in advance
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Post your code or, better still, a link to a test page. Also have a read of this article.

    Comment

    • sindhu
      New Member
      • Oct 2006
      • 53

      #3
      Thanks for the reply

      the code goes as follows

      [CODE=javascript]function getpage(val)
      {
      //alert(num);
      self.location=' page2.html?'+va l;

      document.frame2 .txt2.value =val;


      }

      [/CODE] here val is the value to be passed
      self.location replaces the page at that frame with the given html page
      frm2 if the frame in the new page
      txt2 is the control where i want the val to be saved in the second page

      but this is not working fine . it does go to the second page but the val is not shown in the textbox of second page

      please help
      Last edited by acoder; Feb 7 '08, 10:44 AM. Reason: Added code tags

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Since you're changing the location of the current page, the rest of the code won't execute. You are passing the value in the URL, so use the location.search property in the new page, page2.html. You can set the textbox value onload.

        Comment

        • sindhu
          New Member
          • Oct 2006
          • 53

          #5
          Hi i did that in the new page as below
          var query =window.locatio n.search;

          ......script... ............... .

          document.frm2.t xt2.value=windo w.location.sear ch.substring(1) ;

          ..........
          frm2 is the frame name in new page
          the value is being passed i can get it in alert box
          but it is not substituted in the textbox txt2
          the error its showing up is 'the document.frm2.t xt2' is null or not an object
          thanks

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            So now we're getting somewhere. Post the code for the new page.

            Comment

            • sindhu
              New Member
              • Oct 2006
              • 53

              #7
              for sending page


              [CODE=javascript] function change_page(num )
              {
              //alert(num);
              self.location=' page2.html?'+nu m;
              }
              [/CODE]



              for receiving page

              [HTML]<script language="javas cript" type="text/javascript">
              var query =window.locatio n.search;
              alert(query.sub string(1));
              document.frm2.t xt2.value=query ;
              </script>[/HTML]
              Last edited by acoder; Feb 7 '08, 11:31 AM. Reason: Added code tags

              Comment

              • sindhu
                New Member
                • Oct 2006
                • 53

                #8
                here is the script in both the pages


                for sending page


                [CODE=javascript] function change_page(num )
                {
                //alert(num);
                self.location=' page2.html?'+nu m;
                }
                [/CODE]


                for receiving page

                [CODE=javascript] <script language="javas cript" type="text/javascript">
                var query =window.locatio n.search;
                alert(query.sub string(1));
                document.frm2.t xt2.value=query ;
                </script>
                [/CODE]
                thanks for such a quick reply
                Last edited by acoder; Feb 7 '08, 11:32 AM. Reason: Added code tags

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  Is the code in the receiving page in the head. If it is, the textbox will be undefined. Put the code in a function and call it body/window onload.

                  Please use code tags when posting code. Thanks!

                  Comment

                  • sindhu
                    New Member
                    • Oct 2006
                    • 53

                    #10
                    thanks alot for your timely help
                    its working. :) :)

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      #11
                      You're welcome. Glad it helped.

                      Comment

                      Working...