急需解决,在线等待
下面是一个可模糊查询的select。
问题:输入内容后如不选择select里的内容,就取不到输入的值(查询无效)
<script language= "javascript " for= "window " event= "onLoad "> init(); </script>
<script language= "JavaScript ">
<!--
var arrList=null;
function init(){
var aa=document.getElementById( "selId ");
var opts=aa.options;
var len=opts.length;
arrList= new Array(len);
for(var i=0;i <len;i++)
arrList[i]=opts[i].text.toLowerCase();
}
function keyup(src){
var bb= " ";
var aa=document.getElementById( "selId ");
var len=src.value.length;
for(var i=0;i <arrList.length;i++){
if(arrList[i].substring(0,len)==src.value)
bb+= ' <option value= " '+arrList[i]+ ' "> '+arrList[i]+ ' </option> ';
}
aa.outerHTML= ' <select id= "selId " style= "position:absolute; left: 390px; top: 119px; width: 400px; height: 20px; clip: rect(0 410 21 382);FONT-SIZE: 9pt; FONT-FAMILY: 宋体,MS SONG,SimSun,tahoma,sans-serif; " selected onChange= "txtInput.value=this.options[this.selectedIndex].text;txtInput.select() "> '+bb+ ' </select> ';
}
//-->
</script>
<form name= "form1 " action= "getBuildUnitFrameList " method= "post ">
<TABLE cellSpacing=1 cellPadding=3 width= "100% " border=0 class=wikitable>
参建单位
<input type= "text " name= " " id= "txtInput " onkeyup= "keyup(this) " style= "position:absolute; left: 390px; top: 119px; width: 400px; height: 20px;FONT-SIZE: 9pt; FONT-FAMILY: 宋体,MS SONG,SimSun,tahoma,sans-serif; ">
<select name= "manufacturerName " id= "selId " style= "position:absolute; left: 390px; top: 119px; width: 400px; height: 20px; clip: rect(0 410 21 382);FONT-SIZE: 9pt; FONT-FAMILY: 宋体,MS SONG,SimSun,tahoma,sans-serif; " onChange= "txtInput.value=this.options[this.selectedIndex].text;txtInput.select() ">
<c:forEach var= "buildUnitVO " items= "${requestScope.BuildUnitList} " varStatus= "status ">
<option value= " <c:out value= '${buildUnitVO.manufacturerName} '/> "> <c:out value= '${buildUnitVO.manufacturerName} '/> </option>
</c:forEach>
</select>
<input type= "submit " name= "search " value= "查 询 " style= "position:absolute; left:800px; top: 119px; ">