In case anyone in is need...
<html>
<head>
<script language="javascript">
function getStates () {
stateCodes = new Array('AK','AL','AR','CA','CO','CT','DC','ETC');
for (var stateOptions='',$i=0; $i < stateCodes.length; $i++) {
stateOptions = stateOptions + "<option value=\"" + stateCodes[$i] +
"\">" + stateCodes[$i] + "</option>";
}
return stateOptions;
}
function addStateOption () {
var stateCount =
parseInt(document.getElementById('stateCounter').v alue) + 1;
for (emptyField=false, i=1; i < stateCount; i++) {
if (document.getElementById('s' + i).value == '') {
emptyField = true;
document.getElementById('s' + i).style.backgroundColor = "#FFFFD9";
} else {
document.getElementById('s' + i).style.backgroundColor = "#FFFFFF";
}
}
if (emptyField != true) {
document.getElementById('states').innerHTML =
document.getElementById('states').innerHTML
+ "<select id='s" + stateCount + "' name='s" + stateCount + "'>"
+ "<option value=''>Select State</option>"
+ getStates()
+ "</select>"
+ "<br>";
document.getElementById('stateCounter').value = stateCount;
}
}
</script>
</head>
<body>
<div id="states"></div>
<a href="javascript:addStateOption();">Add State</a>
<input id="stateCounter" type="hidden" value="0">
</body>
</html>