日期:2014-05-16  浏览次数:20435 次

有没有现成的可写的select下拉框
想让select下拉框的内容可以让用户输入也可以选择
有没有现成的代码?

------解决方案--------------------
<select id= "s ">
<option> a </option>
<option> b </option>
<option> c </option>
</select>
<input id= "i "> <input type= "button " onclick= "c() " value= "改变 ">
<script>
so = document.getElementById( "s ");
io = document.getElementById( "i ");
function c()
{
for(co=0;co <so.length;co++)
{
if(so.options[co].text==io.value) so.selectedIndex=co;
}
}
</script>
------解决方案--------------------
<html>
<head>
<script language= "javascript ">
function selectChange()
{
document.all.text.value = document.all.select.value;
}
</script>
</head>
<body>
<div>
<select id= 'select ' style= "position:absolute;width:150px;clip: rect(0 180 110 130) " onchange= "selectChange() ">
<option value= '1 '> 1 </option>
<option value= '2 '> 2 </option>
<option value= '3 '> 3 </option>
<option value= '4 '> 4 </option>
</select>
<input type= 'text ' id= 'text 'style= "position:absolute;width:150px; " value= "1 " onfocus= "this.value= ' ';document.all.select.value= ' '; ">
</div>
</body>
</html>