passing the selected value of dropdown box to the next html page

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

    passing the selected value of dropdown box to the next html page

    Hello acoder. I want to know another type of passing values between pages

    I have three frames
    frame1 for main horizontal menu
    frame 2 for vertical submenu
    frame 3 which is is loaded based on frame 2 submenu seletion

    now i want to have value to be passed between the pages on frame3 based on submenu selection in frame 2


    the frame2 has submenu as below
    in a table there are two images based on selection of these i'm loading frame3

    [HTML]<td><a onmouseover="sw apImage()" onmouseout="swa pImgRestore()" target="right_b ottom" href="page1.htm l" >
    <img id="img" src= "Images.jpg " alt="img" name="img" border="0"/>
    </a>
    </td>
    <td><a onmouseover="sw apImage()" onmouseout="swa pImgRestore()" target="right_b ottom" href="page2.htm l" >
    <img id="img2" src= "Images2.jp g" alt="img" name="img2" border="0"/>
    </a>
    </td>
    [/HTML]
    now i want to pass value from page1 to page 2
    please give me some idea
    thanks
    Last edited by acoder; Feb 8 '08, 09:23 AM. Reason: Added code tags
  • sindhu
    New Member
    • Oct 2006
    • 53

    #2
    passing values between html pages by using frames

    Hello folks
    . I want to know another type of passing values between pages

    I have three frames
    frame1 for main horizontal menu
    frame 2 for vertical submenu
    frame 3 which is is loaded based on frame 2 submenu seletion

    now i want to have value to be passed between the pages on frame3 based on submenu selection in frame 2


    the frame2 has submenu as below
    in a table there are two images based on selection of these i'm loading frame3

    [HTML]<td><a onmouseover="sw apImage()" onmouseout="swa pImgRestore()" target="right_b ottom" href="page1.htm l" >
    <img id="img" src= "Images.jpg " alt="img" name="img" border="0"/>
    </a>
    </td>
    <td><a onmouseover="sw apImage()" onmouseout="swa pImgRestore()" target="right_b ottom" href="page2.htm l" >
    <img id="img2" src= "Images2.jp g" alt="img" name="img2" border="0"/>
    </a>
    </td>[/HTML]

    now i want to pass value from page1 to page 2
    please give me some idea
    thanks
    Last edited by gits; Feb 8 '08, 08:33 AM. Reason: added code tags

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Which value do you want to pass?
      Last edited by acoder; Feb 8 '08, 09:52 AM.

      Comment

      • sindhu
        New Member
        • Oct 2006
        • 53

        #4
        passing the selected value of dropdown box to the next html page

        Hello,
        I want to pass the selected value of dropdown list to next page based on the selction of a menu in the same frameset

        Please help me out

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          I've split and merged some posts into this new thread.

          Post the code for the drop down box. When you say you want to pass to the page, where should it be available? Does some element's value need to be set? Show the code for the page that the value has to be passed to.

          Comment

          • sindhu
            New Member
            • Oct 2006
            • 53

            #6
            there are three frames.
            frame1 - mainmenu
            frame2- submenu
            frame3-display pages based on submenu

            The dropdown is in all the pages that i'm displaying in frame3 by using submenu.the selections are

            [CODE=html]<select id="ddbx" class="textBlac kMedium" style="width: 87px" name="ddbx" onchange="switc h">
            <option>OP 1</option>
            <option>OP 2</option>
            <option>OP 3</option>
            <option>OP 4</option>
            </select>
            [/CODE]
            now when i select 1in submenu, i'm loading the frame3 with 'page1' in which i've the dropdown shown above.
            now if i change the selection to 'OP 2' in the dropdown, and select submenu item to load 'page2' in the frame three replacing 'page1' , i want the dropdown in that page to be having the selcted value 'OP 2'.

            below is the code to change the pages in frame3

            [HTML]<tr style="width:11 1px;height:30px "><td >
            <a onmouseover="sw apImage()" onmouseout="swa pImgRestore()" target="right_b ottom" href="page1html " >
            <img id="img1" src= "Images1" alt="1" name="img1" border="0"/></a></td></tr>
            <tr ><td >
            <a onmouseover="sw apImage()" onmouseout="swa pImgRestore()" target="right_b ottom" href="page2.htm l">
            <img id="img2" src= "Images/2" alt="2" name="img2" border="0"/></a></td></tr>
            [/HTML]
            this is the sub menu with two options. target='right_b ottom' , here right_bottom is the name of frame3. i'm using href to chnge the page on change.

            now i wnt the changed value in dropdown of any page to be reflected in the pages after changing the submenu selection
            Last edited by acoder; Feb 8 '08, 01:29 PM. Reason: Added code tags

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              As a full member now, you should know that we expect your code to be posted in [CODE] tags (See How to Ask a Question).

              This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

              Please use the tags in future.

              MODERATOR.

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Originally posted by sindhu
                The dropdown is in all the pages that i'm displaying in frame3 by using submenu.the selections are

                [CODE=html]<select id="ddbx" class="textBlac kMedium" style="width: 87px" name="ddbx" onchange="switc h">
                <option>OP 1</option>
                <option>OP 2</option>
                <option>OP 3</option>
                <option>OP 4</option>
                </select>
                [/CODE]
                now when i select 1in submenu, i'm loading the frame3 with 'page1' in which i've the dropdown shown above.
                now if i change the selection to 'OP 2' in the dropdown, and select submenu item to load 'page2' in the frame three replacing 'page1' , i want the dropdown in that page to be having the selcted value 'OP 2'.
                In your onchange function call, get the selected value of the drop down, e.g. document.getEle mentById("ddbx" ).value (you will need to set the value of each option). Then access the frame, e.g. parent.right_bo ttom and set the value of the drop down by setting its value.

                Comment

                • sindhu
                  New Member
                  • Oct 2006
                  • 53

                  #9
                  Hello i'm able to fetch the value of the selected dropdown box from the dropdown and save it in a 'temporary variable'(like assigning it to a hidden button value) in the submenu frame. now i'm calling another page from submenu using href="page2"
                  during this call i want to pass the selected index value stored in temporary variable.

                  how do i do this in href="page2.htm l?"

                  What do i need to include after the question mark?

                  the temporary value is in


                  <input name="btn_hid" id="btn_hid" style="position :absolute; left: 17px; top: 106px;visibilit y=hidden">
                  </input>

                  and i'm calling the page in href as below

                  <a onmouseover="sw apImage('img_md ','','Imagest1. jpg',1)" target="right_b ottom" href="page2.htm l" >
                  <img src= "Images2.jp g" alt="img2" name="img_md" border="0"/>
                  </a>



                  href ib bold is the point from where i'm passing the value to page2.html and assigning it to dropdown in that page

                  thanks

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    You could use document.getEle mentById("btn_h id").value to get the value.

                    Pass it using page2.html?val= ...

                    Comment

                    • sindhu
                      New Member
                      • Oct 2006
                      • 53

                      #11
                      i'm stuck at this point itself.

                      i'm able to fetch the value in button using

                      Code:
                      <script lang=javascript>
                                   var sel= document.frm.btn_id.value
                      </script>
                      But in href=" page2.html?val= sel" that value will not be fetched but a blank value or "?val=sel" appears.

                      is the way i'm including the value right or its different
                      Last edited by acoder; Feb 12 '08, 08:05 AM. Reason: fixed code tag

                      Comment

                      • acoder
                        Recognized Expert MVP
                        • Nov 2006
                        • 16032

                        #12
                        Give the link an id and then change the href:
                        [code=javascript]var link = document.getEle mentById("link" );
                        link.href = "page2.html?val ="+sel;[/code]

                        Comment

                        • sindhu
                          New Member
                          • Oct 2006
                          • 53

                          #13
                          Thousand thanks are less for the immense help you have lent to me.
                          Its working perfectly.
                          Thanks alot

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            #14
                            You're welcome! Glad to hear that it works.

                            Comment

                            Working...