The company has a set of systems, and the Select menu stores too many categories. It is very difficult to find a category each time and a search is made.
I wrote comments for your reference.
form id =" form1 " name =" form1 " method =" Post " action =" ">
select name =" select " size =" 20 " id =" myselect " multiple =" multiple ">
Option value =" 11 "> 111444 Option >
Option value =" 22 "> 211144 Option >
Option value =" 33 "> 311155 Option >
Option value =" 44 "> 422355 Option >
<Option Value= "55">533333</Option>
</Select>
input name =" keywords " type =" text " id =" keywords ">
input type =" button " name =" button " id =" button " value =" Search for him " onclick =" selectone (document. getelementbyid ('keyword '). value) ">
</Form>
script language =" JavaScript ">
//ParametersKeywords ---InputKeywordSelectindex ---SpecifySelectIndex value of the Set
FunctionSelectone (keywords, selectindex)
{
KEYWORDS = keywords. Replace (// G,"")//Remove Spaces
var myselect = document. getelementbyid ( "myselect" ) // get the select Object
var J = 0; // Data Statistics
For(I = 0; I <myselect. length; I ++)//LoopOption
{
If(Myselect. Options [I]. Text. indexof (keywords )! =-1)//JudgmentOptionOfTextInclude or notKeyword
{
Myselect. Options [I]. Selected =True;//Selected
J ++;//Statistics
}
Else
{
Myselect. Options [I]. Selected =False;//Does not containKeywordsUnselect,If this clause is not added, it will be selected again
}
}
alert (" found " + J + " item " )
}
</Script>