I put this together yesterday, and I thought I'd share it.
It works in both IE and Mozilla Firefox. I posted something
similar to this months back, but it was much longer, and only
worked in IE.
Shawn
function searchList(inTe xt, drpBox){
var iCount;
var regEx = new RegExp(inText, 'i');
for (iCount=0; iCount<drpBox.l ength; iCount++){
if (drpBox[iCount].value.match(re gEx)){
drpBox.selected Index = iCount;
break;
}
}
}
Put this on the form near the drop-down box:
<input type="text" name="txtSearch " id="txtSearch" value="search list"
onfocus="if (this.value == 'search list'){ this.value='';} "
onkeyup="search List(this.value , document.forms['frmAdd'].drpSponsor);"
/><br/>
It works in both IE and Mozilla Firefox. I posted something
similar to this months back, but it was much longer, and only
worked in IE.
Shawn
function searchList(inTe xt, drpBox){
var iCount;
var regEx = new RegExp(inText, 'i');
for (iCount=0; iCount<drpBox.l ength; iCount++){
if (drpBox[iCount].value.match(re gEx)){
drpBox.selected Index = iCount;
break;
}
}
}
Put this on the form near the drop-down box:
<input type="text" name="txtSearch " id="txtSearch" value="search list"
onfocus="if (this.value == 'search list'){ this.value='';} "
onkeyup="search List(this.value , document.forms['frmAdd'].drpSponsor);"
/><br/>
Comment