hello everybody...
i have a standard dropdown menu containing all the us states..
what i want to do is when somebody selects a state i want to change the contents of a div element further down the page
the div i want to change is called map
heres what i have:
the standard select box with javascript call
Code:<select id="state" onchange='check_state()'name="state" size="1" tabindex="1"> <option value="">-- Please select --</option> <option value="Alabama">Alabama</option> <option value="Alaska">Alaska</option> <option value="American Samoa">American Samoa</option> <option value="Arizona">Arizona</option> <option value="Arkansas">Arkansas</option> <option value="California">California</option> <option value="Colorado">Colorado</option> .... etc </select>
heres my javascript code that i found
Code:function check_state() { x = document.getElementById('state'); regex=/Alabama/i; if (regex.test(x.options[x.selectedIndex].innerHTML)) { div = document.getElementById('map'); div.innerHTML = 'Alabama'; regex=/Alaska/i; if (regex.test(x.options[x.selectedIndex].innerHTML)) { div = document.getElementById('map'); div.innerHTML = 'Alaska; etc....
am i going about this the wrong way...
what i want is if somebody selects Alabama the contents of the div map changes to Alabama
if alaska it changes to alaska and so on for all states
can somebody please point me in the right direction



Anthony Thomas - Internet Design, Development and Promotion


Bookmarks