做了一个效果,不知道大家能不能用上
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>New Page 1</title>
</head>
<script>
function selectOther(list) {
var input = document.createElement("INPUT");
input.className = "select";
input.type = "text";
input.onblur = function() {
var list = this.oldNode;
list.options[list.options.length - 1] = new Option(this.value, "", true);
list.options[list.options.length] = new Option("Other...");
list.selectedIndex = list.options.length - 2;
this.parentNode.replaceChild(list, this);
};
input.oldNode = list.parentNode.replaceChild(input, list);
}
</script>
<body>
<p><select size="1" name="D1">
<option>111</option>
<option>222</option>
<option>333</option>
</select><input type="submit" value="添加" name="B1" onclick=selectOther(D1)></p>
</body>
</html>