How get value of a drop down in Internet Explorer?

Discussion in 'Javascript' started by antiinertia@gmail.com, Apr 19, 2007.

  1. Guest

    How does one find the value of a drop down in Internet Explorer?

    The form below works in Firefox and Safari. But not in Internet
    Explorer. Can someone tell me how to code this so IE understands it?

    <script language="javascript">
    function copyDescription() {

    document.myForm.Description.value=document.myForm.MakeDescription.value
    }
    </script>

    <form name="myForm" id="myForm">
    <SELECT name="MakeDescription" onChange="copyDescription();">
    <OPTION selected value="">Choose</OPTION>
    <OPTION>A</OPTION>
    <OPTION>B</OPTION>
    <OPTION>C</OPTION>
    </SELECT>
    <br /><br />
    <input name="Description" id="Description" type="text" />
    </form>

    Any help appreciated!
    , Apr 19, 2007
    #1
    1. Advertising

  2. RobG Guest

    On Apr 20, 7:27 am, wrote:
    > How does one find the value of a drop down in Internet Explorer?
    >
    > The form below works in Firefox and Safari. But not in Internet
    > Explorer. Can someone tell me how to code this so IE understands it?
    >
    > <script language="javascript">


    The language attribute is deprecated, type is required.


    > function copyDescription() {
    >
    > document.myForm.Description.value=document.myForm.MakeDescription.value}


    Since your options don't have value attributes but do have text
    attributes, you can use:


    document.myForm.Description.value=document.myForm.MakeDescription.text;


    Why doesn't IE follow the W3C spec? Dunno.


    >
    > </script>
    >
    > <form name="myForm" id="myForm">
    > <SELECT name="MakeDescription" onChange="copyDescription();">
    > <OPTION selected value="">Choose</OPTION>
    > <OPTION>A</OPTION>
    > <OPTION>B</OPTION>
    > <OPTION>C</OPTION>
    > </SELECT>
    > <br /><br />
    > <input name="Description" id="Description" type="text" />
    > </form>



    --
    Rob
    RobG, Apr 20, 2007
    #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. SirPoonga
    Replies:
    2
    Views:
    759
    Ben Strackany
    Jan 7, 2005
  2. weiwei
    Replies:
    0
    Views:
    1,014
    weiwei
    Jan 5, 2007
  3. msimmons
    Replies:
    0
    Views:
    473
    msimmons
    Jul 16, 2009
  4. Replies:
    5
    Views:
    267
  5. Replies:
    3
    Views:
    285
Loading...

Share This Page