I have a JavaScript that sniffs out the Timezone Abbreviation of the users
local machine:

AKST EDT MST PST CST etc

I have a select box that lists out the Timezones

<select name="strTimeZone" >
    <option value="HADT"> Hawaii-Aleutian Daylight Time
    <option value="HAST"> Hawaii-Aleutian Standard Time
    <option value="AKDT"> Alaska Daylight Time
    <option value="AKST"> Alaska Standard Time
    <option value="PDT"> Pacific Daylight Time
Etc.....

</select>

I am able to programmaticly selected an item using the numeric
selectedIndex  value like so
--------------------
var x=document.getElementById("strTimeZone");
x.options.selectedIndex=1;

----------------------

Now how do I do this by using the option tags *value* that I have already
parsed from the JS time object?

If the time zone was PDT would select this item:

<option value="PDT"> Pacific Daylight Time


w3schools has an example using the *text* attribute (the items displayed in
the drop down) Like so

http://www.w3schools.com/js/tryit.asp?filename=try_dom_option_settext

-----------------------------
<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

But no dice...

Any suggestion other that to build a JS array from the TimeZone database
table and use that?

TIA

Gerald


-- 
"There is a theory which states that if ever anybody discovers exactly
what the Universe is for and why it is here, it will instantly disappear
and be replaced by something even more bizarre and inexplicable.
There is another theory which states that this has already happened."

-- Douglas Adams


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:298584
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