Change select from other select


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Change select from other select

  1. #1
    Brian Guest

    Change select from other select


    I am able to change what is selected in one select box when changing the selection
    in another select box using the onChange event in IE, but it does not work
    in Netscape. By passing
    a value to the following line of code, it does nothing in Netscape:

    document.general.SelectObjectName.options.value = passedValue;

    How can I get this to work in Netscape and IE?

    Thanks,

    Brian

  2. #2
    Russell Jones Guest

    Re: Change select from other select

    Just a guess, but it looks like you're missing an index value. The code
    should be:
    document.general.SelectObjectName.options[index].value = passedValue;


    "Brian" <bminisi@accessgroup.org> wrote in message
    news:3a6de423$1@news.devx.com...
    >
    > I am able to change what is selected in one select box when changing the

    selection
    > in another select box using the onChange event in IE, but it does not

    work
    > in Netscape. By passing
    > a value to the following line of code, it does nothing in Netscape:
    >
    > document.general.SelectObjectName.options.value = passedValue;
    >
    > How can I get this to work in Netscape and IE?
    >
    > Thanks,
    >
    > Brian




  3. #3
    Frederiek Guest

    Re: Change select from other select


    The correct syntax is:
    document.formName.selectName.options[document.formName.selectName.selectedIndex].value

    where you have to change "formName" and "selectName" to respectively the
    names of your form and select box.

    cya
    Frederiek


    "Russell Jones" <arj1@northstate.net> wrote:
    >Just a guess, but it looks like you're missing an index value. The code
    >should be:
    >document.general.SelectObjectName.options[index].value = passedValue;
    >
    >
    >"Brian" <bminisi@accessgroup.org> wrote in message
    >news:3a6de423$1@news.devx.com...
    >>
    >> I am able to change what is selected in one select box when changing the

    >selection
    >> in another select box using the onChange event in IE, but it does not

    >work
    >> in Netscape. By passing
    >> a value to the following line of code, it does nothing in Netscape:
    >>
    >> document.general.SelectObjectName.options.value = passedValue;
    >>
    >> How can I get this to work in Netscape and IE?
    >>
    >> Thanks,
    >>
    >> Brian

    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center