> <script>
> var x=document.getElementById("mySelect");
> x.options[x.selectedIndex].text="Melon";
> </script>
> 
> <select id="mySelect">
>   <option>Apple</option>
>   <option>Orange</option>
>   <option>Pineapple</option>
>   <option>Banana</option>
> </select>
> ---------------------------
> 
> 
> I googled it and I can't find a way to do it using the 
> "value=" attribute (which I already have)
> 
> I tried doing this:
> -----------------------------
> var x=document.getElementById("strTimeZone");
> x.options[x.selectedIndex].value="PDT";
> ---------------------------
> 
> Would (in theory) select this item:
> <option value="PDT"> Pacific Daylight Time

If I understand correctly, you're looking for something like this:

var x = document.getElementById("mySelect");
for (var i = 0; i < x.options.length; i++) {
        if (x.options[i].value == "PDT") {
                x.options[i].selected = true;
                break;
        }
}

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Training: Adobe/Google/Paperthin Certified Partners
http://training.figleaf.com/

WebManiacs 2008: the ultimate conference for CF/Flex/AIR developers!
http://www.webmaniacsconference.com/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298592
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to