Ask Experts Questions for FREE Help !
Ask
    xuanmanh's Avatar
    xuanmanh Posts: 24, Reputation: 1
    New Member
     
    #1

    May 22, 2006, 03:02 AM
    How to set the selection of a combo list
    Does anyone know wherer there is a javascript method to set the selection of a combo list?
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #2

    May 22, 2006, 04:49 AM
    Something like this maybe...

    Imagine you had the following list:
    Code:
    <select name="testselect">
        <option value="first">first option</option>
        <option value="second">second option</option>
        <option value="third">third option</option>
    </select>
    You could then have a function like below:
    Code:
    function selectMe(val) {
        for (var i=0; i<document.all.testselect.length; i++) {
            if (document.all.testselect.options[i].value == val) {
                document.all.testselect.options[i].selected = true;
            } 
        }
    }
    So if you called selectMe with a value of "second", it would select the second option in the dropdown.

    Is that what you meant?
    xuanmanh's Avatar
    xuanmanh Posts: 24, Reputation: 1
    New Member
     
    #3

    Jun 1, 2006, 04:59 AM
    Yes, absolultely right, My problem was solved so well. Thank you very much

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

AC/Heating Unit Combo HELP [ 2 Answers ]

We have, I believe, a 2-ton Lennox AC/Heating roof-top unit. Lately, the unit was having trouble cooling the house, which is about 1,500 - 1,700 sq ft. We could set the thermostat to 68 degrees, and the house would only cool down to 80 degrees. Yesterday, the unit stopped blowing cold air...

Lite On Combo Drive [ 1 Answers ]

Having trouble finding the drivers for a Lite On Combo LTC-48161H dvd/rw drive.According to various Googling I've done,the driver download sites on the net,are either incomprehensible,or don't work.Even the manufacturers site does a 404! In other words,as things stand,the combo-drive does zip,and...

Is there any way to do this 3-way combo? [ 2 Answers ]

G'day guys. I'm attaching a diagram of what I have. Power comes to the box at the back wall in my kitchen. From there I have one switch to control the back porch light, and a 3-way switch that controls the kitchen lights. On the other wall, adjacent to the dining room, is the other 3-way...

Shoot-set and Quick-set Combo [ 2 Answers ]

I have not seen this yet, but I haven't seen everything... lol I was thinking that these two misdirection sets could be used in a single play because the quick-set causes the opponent to position, dig-in, and focus on the quick-set hitter, but the ball could be shoot-set along the net for anyone...

Pipe selection [ 2 Answers ]

My plumbing is on the attic and my roof is very low,the pipes ,for hot and cold water are galvanized and very old,I would like to replace them with PVC schedule 40 for cold water and Chlorinated PVC schedule 40 for hot water,is this a good idea ? Please reply,thanks .


View more questions Search