This rather large code works like this:
In stead of filling a new select list every time you make a choice of country, fill a lot of select lists and display only the one chosen.
I guess it's a bit more complicated than your code needs to be if you are only choosing country once for each session.
PS. Please notice the difference between COUNTY and COUNTRY
<html><head>
<script>
p = new Array();
p[0] = [
"Kies een provincie",
"Groningen",
"Friesland",
"Drenthe",
"Gelderland"
];
p[0].country = "Nederland";
p[1] = [
"Choose a county",
"Bedfordshire",
"Berkshire",
"Buckinghamshire",
"Cambridgeshire",
"Cheshire",
"Cornwall",
"Cumberland",
"Derbyshire",
"Devon",
"Dorset",
"Durham",
"Essex",
"Gloucestershire",
"Hampshire",
"Herefordshire",
"Hertfordshire",
"Huntingdonshire",
"Kent",
"Lancashire",
"Leicestershire",
"Lincolnshire",
"Middlesex",
"Norfolk",
"Northamptonshire",
"Northumberland",
"Nottinghamshire",
"Oxfordshire",
"Rutland",
"Shropshire",
"Somerset",
"Staffordshire",
"Suffolk",
"Surrey",
"Sussex",
"Warwickshire",
"Westmorland",
"Wiltshire",
"Worcestershire",
"Yorkshire",
"Anglesey/Sir Fon",
"Brecknockshire/Sir Frycheiniog",
"Caernarfonshire/Sir Gaernarfon",
"Carmarthenshire/Sir Gaerfyrddin",
"Cardiganshire/Ceredigion",
"Denbighshire/Sir Ddinbych",
"Flintshire/Sir Fflint",
"Glamorgan/Morgannwg",
"Merioneth/Meirionnydd",
"Monmouthshire/Sir Fynwy",
"Montgomeryshire/Sir Drefaldwyn",
"Pembrokeshire/Sir Benfro",
"Radnorshire/Sir Faesyfed",
"Aberdeenshire",
"Angus/Forfarshire",
"Argyllshire",
"Ayrshire",
"Banffshire",
"Berwickshire",
"Buteshire",
"Cromartyshire",
"Caithness",
"Clackmannanshire",
"Dumfriesshire",
"Dunbartonshire/Dumbartonshire",
"East Lothian/Haddingtonshire",
"Fife",
"Inverness-shire",
"Kincardineshire",
"Kinross-shire",
"Kirkcudbrightshire",
"Lanarkshire",
"Midlothian/Edinburghshire",
"Morayshire",
"Nairnshire",
"Orkney",
"Peeblesshire",
"Perthshire",
"Renfrewshire",
"Ross-shire",
"Roxburghshire",
"Selkirkshire",
"Shetland",
"Stirlingshire",
"Sutherland",
"West Lothian/Linlithgowshire",
"Wigtownshire"];
p[1].country = "Great Britain";
var displayedSelect = null;
function fillSelect() {
sel = document.getElementById("SELECT");
// Fill country SELECT
country = document.getElementById("COUNTRY");
opt = document.createElement("OPTION");
opt.innerHTML = "Choose a country";
country.appendChild(opt);
for(s=0;s<p.length;s++) {
opt = document.createElement("OPTION");
opt.innerHTML = p[s].country;
country.appendChild(opt);
// Fill county SELECTs
county = document.createElement("SELECT");
county.onchange = selectCounty;
county.id = p[s].country;
county.style.display = "none";
for(t=0;t<p[s].length;t++) {
opt = document.createElement("OPTION");
opt.innerHTML = p[s][t];
county.appendChild(opt);
}
sel.appendChild(county);
}
displayedSelect = document.getElementById("COUNTY");
}
function selectCounty() {
alert("selected county:
"+displayedSelect.options[displayedSelect.options.selectedIndex].text);
}
function selectCountry(e) {
displayedSelect.style.display = "none";
if(e==0)
displayedSelect = document.getElementById("COUNTY");
else
displayedSelect = document.getElementById(p[parseInt(e)-1].country);
displayedSelect.style.display = "block";
}
</script>
</head><body onload="fillSelect()">
<form id="test" name="test" method="post" action="" >
<table>
<tr>
<td>Country:
<td><select id="COUNTRY" onChange = "selectCountry(this.options.selectedIndex)"></select>
<tr><td>County:
<td>
<div id="SELECT"></div>
<div id="COUNTY" style="display:block">No country selected</div>
</table></form>
</body>
</html>
[SIZE]