Passing Drop Down List Selected Value

Discussion in 'Javascript' started by maflu, Nov 18, 2003.

  1. maflu

    maflu Guest

    Hello,
    I am rather a beginner in Javascript and have the following problem.
    There is a drop down list on my Web page with various values to be
    selected by the user. Once the user has selected a value, he/she clicks
    on the submit button. When he/she does that I would like 2 things to
    happen: the selected value of the drop down list is passed to another
    html page which opens in a new brower window open.

    Could you please help me do write that?

    Thank you :)

    Cheers
     
    maflu, Nov 18, 2003
    #1
    1. Advertising

  2. maflu

    Mike Guest

    An easy solution (for IE anyway not sure if it works in Mozilla) is to
    simply open up the new window and load the html page and then in the onLoad
    event handler reference the value of the select in the original window using
    the window.opener attribute.

    --orginal html

    <html>
    <head>
    <script>
    ...code to open new window here...
    </script>
    </head>
    <body>
    <select id="mySelect"><option value =1 selected>Option 1</select>
    </body>
    </html>

    --html in new window
    <html>
    <head>
    <script>
    function getSelectValue(){
    alert(window.opener.document.getElementById("mySelect").value);
    }
    </script>
    </head>
    <body onLoad="getSelectValue()">
    </body>
    </html>


    Regards
    Mike

    "maflu" <> wrote in message
    news:3fba5dfb$0$228$...
    > Hello,
    > I am rather a beginner in Javascript and have the following problem.
    > There is a drop down list on my Web page with various values to be
    > selected by the user. Once the user has selected a value, he/she clicks
    > on the submit button. When he/she does that I would like 2 things to
    > happen: the selected value of the drop down list is passed to another
    > html page which opens in a new brower window open.
    >
    > Could you please help me do write that?
    >
    > Thank you :)
    >
    > Cheers
    >
     
    Mike, Nov 20, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephen Adam
    Replies:
    3
    Views:
    12,188
    Stephen Adam
    Nov 30, 2004
  2. weiwei
    Replies:
    0
    Views:
    1,081
    weiwei
    Jan 5, 2007
  3. jaysch
    Replies:
    0
    Views:
    1,276
    jaysch
    Apr 30, 2011
  4. Replies:
    5
    Views:
    322
  5. Replies:
    0
    Views:
    196
Loading...

Share This Page