<html>
<head>
<title>Create Form Elements</title>
<script language="javascript">
<!--
function CreateProvince() {
var Primary = document.newforms.country.selectedIndex;
if ((Primary == null) || (Primary == 0)) return;
if (Primary == 1) {
var ProvState = new Array;
ProvState[0] = new Option("Alberta");
ProvState[1] = new Option("British Columbia");
ProvState[2] = new Option("Manitoba");
ProvState[3] = new Option("New Brunswick");
ProvState[4] = new Option("Newfoundland");
ProvState[5] = new Option("Nova Scotia");
ProvState[6] = new Option("Northwest Territories");
ProvState[7] = new Option("Nunavut");
ProvState[8] = new Option("Ontario");
ProvState[9] = new Option("Prince Edward Island");
ProvState[10] = new Option("Quebec");
ProvState[11] = new Option("Saskatchewan");
ProvState[12] = new Option("Yukon");
}
if (Primary == 2) {
var ProvState = new Array;
ProvState[0] = new Option("Alabama");
ProvState[1] = new Option("Alaska");
ProvState[2] = new Option("Arizona");
ProvState[3] = new Option("Arkansas");
ProvState[4] = new Option("California");
ProvState[5] = new Option("Colorado");
ProvState[6] = new Option("Connecticut");
ProvState[7] = new Option("Delaware");
ProvState[8] = new Option("Florida");
ProvState[9] = new Option("Georgia");
ProvState[10] = new Option("Hawaii");
ProvState[11] = new Option("IdahoState");
ProvState[12] = new Option("Illinois");
ProvState[13] = new Option("Indiana");
ProvState[14] = new Option("Iowa");
ProvState[15] = new Option("Kansas");
ProvState[16] = new Option("Kentucky");
ProvState[17] = new Option("Louisiana");
ProvState[18] = new Option("Maine");
ProvState[19] = new Option("Maryland");
ProvState[20] = new Option("Massachusetts");
ProvState[21] = new Option("Michigan");
ProvState[22] = new Option("Minnesota");
ProvState[23] = new Option("Mississippi");
ProvState[24] = new Option("Missouri");
ProvState[25] = new Option("Montana");
ProvState[26] = new Option("Nebraska");
ProvState[27] = new Option("Nevada");
ProvState[28] = new Option("NewHampshire");
ProvState[29] = new Option("NewJersey");
ProvState[30] = new Option("NewMexico");
ProvState[31] = new Option("NewYork");
ProvState[32] = new Option("NorthCarolina");
ProvState[33] = new Option("NorthDakota");
ProvState[34] = new Option("Ohio");
ProvState[35] = new Option("Oklahoma");
ProvState[36] = new Option("Oregon");
ProvState[37] = new Option("Pennsylvania");
ProvState[38] = new Option("RhodeIsland");
ProvState[39] = new Option("SouthCarolina");
ProvState[40] = new Option("SouthDakota");
ProvState[41] = new Option("Tennessee");
ProvState[42] = new Option("Texas");
ProvState[43] = new Option("Utah");
ProvState[44] = new Option("Vermont");
ProvState[45] = new Option("Virginia");
ProvState[46] = new Option("Washington");
ProvState[47] = new Option("WestVirginia");
ProvState[48] = new Option("Wisconsin");
ProvState[49] = new Option("Wyoming");
}
for (i=document.newforms.SelectProvState.options.length; i>0; i--) {
document.newforms.SelectProvState.options[i] = null;
}
for(i=0; i<ProvState.length; i++) {
document.newforms.SelectProvState.options[i] = ProvState[i];
}
document.newforms.SelectProvState.options[0].selected = true;
}
//-->
</script>
</head>
<body>
<form name="newforms">
Choose Country:
<select name="country" onChange="CreateProvince()">
<option value="">Choose Country</a>
<option value="Canada">Canada</a>
<option value="USA">USA</a>
</select>
<select name="SelectProvState">
<option value="1">Choose province/state</option>
</select>
</form>
</body>
</html>
|