js代码:
<script language="JavaScript">
<!--
function add_options(sel)
{
var n = sel.length;
var s = sel.options[sel.selectedIndex].text;
var c = event.keyCode;
//window.status = event.keyCode;
if(c==13)
{
s = "";
sel.options[sel.length] = new Option(s,s,false,true);
}
else
{
if(c==8)
{
s = s.substr(0,s.length-1)
}
else if((c>47 && c<58) || (c>64 && c<91) || (c>97 && c<106))
{
s += String.fromCharCode(event.keyCode);
}
sel.options[sel.selectedIndex].text = s;
}
event.returnValue = false;
}
//-->
</script>
用的时候: <select name="info_val" οnkeydοwn="add_options(this);" size="1">..........