Forum Moderators: open
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function xcats(select) {
if (select.value!= "new") return;
var catName = prompt('Please enter category name:','');
if (!catName) return;
var newOption = document.createElement("option");
newOption.value = catName;
newOption.appendChild(document.createTextNode(catName));
select.insertBefore(newOption, select.lastChild);
select.selectedIndex = select.options.length-2;
}
</script>
</head>
<body>
<form name="test">
<select name="cats" onchange="xcats(this)">
<option value="general">General</option>
<option value="community">Community</option>
<option value="new">New category</option>
</select>
</form>
</body>
</html>