Select List Changes

[Total: 0    Average: 0/5]

This shows how to build a dynamic select list.

Body Code:

<form name=ex_f1>
<select name=countries>
<option value="" SELECTED>Select A Number</option>
</select>
</form>
<script>
var regionsArray = new Array(7); 
regionsArray[0] = new Array("Botswana","Ethiopa","Kenya","Madagascar","Mali","Morocco","Namibia","South Africa","Tanzania","Uganda","Zambia","Zimbabwe"); 
regionsArray[1] = new Array("Argentina","Belize","Bolivia","Brazil","Chile","Costa Rica","Galapagos","Panama","Peru"); 
regionsArray[2] = new Array("Bhutan","Burma","Cambodia","China","India","Ladakh","Laos","Multi-Country","Nepal","Thailand","Tibet","Vietnam"); 
regionsArray[3] = new Array("Greece","Italy","Turkey"); 
regionsArray[4] = new Array("Egypt","Iran","Israel","Jordan","Lebanon","Oman","Syria"); 
regionsArray[5] = new Array("Australia","Hawaii","Indonesia","New Zealand","Samoa"); 
regionsArray[6] = new Array("Antarctic","Arctic") 
function updateCountries(n) { 
var _F=document.ex_f1;
var arr = regionsArray[n]; 
var current = _F.countries.options.length; 
for (var j=current;j>0;j--) _F.countries.options[j] = null; 
for (var i=0;i<arr.length;i++) _F.countries.options[_F.countries.options.length] = new Option(arr[i],arr[i]); 
_F.countries.options[0].text="Choose Here Now";
}
</script>
<a href="javascript:updateCountries(0)">0</a> |
<a href="javascript:updateCountries(1)">1</a> |
<a href="javascript:updateCountries(2)">2</a> |
<a href="javascript:updateCountries(3)">3</a> |
<a href="javascript:updateCountries(4)">4</a> |
<a href="javascript:updateCountries(5)">5</a> |
<a href="javascript:updateCountries(6)">6</a>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *