A section of the simulation button to find the file JS, I hope you can use

Source: Internet
Author: User
Tags count
JS in doing the project, as a result of a lot of records to find out, the user asked to press a health, if the letter or number, other characters at the beginning of the process name exists, directly selected that name, so I used JS simulation of a simple process of locating files.
Put the text box in the table (through CSS to hide the text box, and read only), for the sake of simplicity I did not put CSS, if necessary, please write one, the code is as follows: (very small, and simple:))
<title>display Processes Stat</title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<link href= "Style" rel= "stylesheet" type= "Text/css" ><script language= "JavaScript" >
Count=0
Oldkey= "";
Ifexists=false;
function document.onkeypress () {
if (document.all.processtimes.value>0) {
if ((count==document.all.processname.length) | | (Oldkey!=string.fromcharcode (Event.keycode)) {
count=0;
}
Newkey=string.fromcharcode (Event.keycode);
Oldkey=string.fromcharcode (Event.keycode);
Search=false;
for (j=count;j<document.all.processname.length;j++) {
Str=document.all.processname[j].value;
TMP=STR.SUBSTR (0,1);
if (Tmp==newkey) {
Document.all.processname[j].focus ();
Document.all.processname[j].select ();
count=j+1;
Search=true;
Ifexists=true;
Break
}
count++;
}
if (Search==false && ifexists==true) {
Ifexists=false;
count=0;
Document.onkeypress ();
}
}
}
</script>



<table width= "100%" border= "1" cellpadding= "2" cellspacing= "0" bordercolor= "#000000" bgcolor= "#FFFFFF" class= " txt105 "style=" Border-collapse:collapse ">
<tr>
&LT;TD align= "right" nowrap width= "11%" >
<input name= "textfield416" type= "text" Id=processname class= "Input4" value= "Ssdfk;d" size= "readonly>"
</td>
&LT;TD align= "right" nowrap width= "5%" >
<input name= "textfield42" type= "text" Id=processname class= "Input4" value= "K;LK;KL;" size= "8" readonly>
</td>
&LT;TD align= "right" nowrap width= "5%" >
<input name= "textfield43" type= "text" Id=processname class= "Input4left" value= "KKKK" size= "8" readonly>
</td>
&LT;TD align= "right" nowrap width= "5%" >
<input name= "textfield44" type= "text" Id=processname class= "input4left" value= "SD" size= "8" readonly>
</td>
&LT;TD align= "right" nowrap width= "6%" >
<input name= "TEXTFIELD45" type= "text" Id=processname class= "Input4" value= "JKL" "size="
</td>
&LT;TD align= "right" nowrap width= "6%" >
<input name= "textfield46" type= "text" Id=processname class= "Input4" value= "Poiuyy" size= "ten" readonly>
</td>
&LT;TD align= "right" nowrap width= "5%" >
<input name= "textfield47" type= "text" Id=processname class= "Input4" value= "Kuoiuouhgkh" size= "8" readonly>
</td>
&LT;TD align= "right" nowrap width= "7%" >
<input name= "textfield48" type= "text" Id=processname class= "Input4" value= "Qwetyuyi" size= "readonly>"
</td>
&LT;TD align= "right" nowrap width= "5%" >
<input name= "textfield49" type= "text" Id=processname class= "Input4left" value= "Iuytre" size= "8" readonly>
</td>
</tr>
<tr>
&LT;TD align= "right" nowrap width= "11%" >
<input name= "Textfield4" type= "text" Id=processname class= "Input4" value= "Serty" size= "readonly>"
</td>
&LT;TD align= "right" nowrap width= "5%" >
<input name= "textfield42" type= "text" Id=processname class= "Input4" value= "MNHGBV" size= "8" readonly>
</td>
&LT;TD align= "right" nowrap width= "5%" >
<input name= "textfield43" id=processname type= "text" Id=processname class= "Input4left" value= "SDFGHK" size= "8" Readonly>
</td>
&LT;TD align= "right" nowrap width= "5%" >
<input name= "textfield44" type= "text" Id=processname class= "Input4left" value= "PMBNVFJ" size= "8" readonly>
</td>
&LT;TD align= "right" nowrap width= "6%" >
<input name= "TEXTFIELD45" type= "text" Id=processname class= "Input4" value= "Yutree" size= "ten" readonly>
</td>
&LT;TD align= "right" nowrap width= "6%" >
<input name= "textfield46" type= "text" Id=processname class= "Input4" value= "Mjkl;h" size= "ten" readonly>
</td>
&LT;TD align= "right" nowrap width= "5%" >
<input name= "textfield47" type= "text" Id=processname class= "Input4" value= "FDSA" size= "8" readonly>
</td>
&LT;TD align= "right" nowrap width= "7%" >
<input name= "textfield48" type= "text" Id=processname class= "Input4" value= "LKJHGF" size= "readonly>"
</td>
&LT;TD align= "right" nowrap width= "5%" >
<input name= "textfield49" type= "text" Id=processname class= "Input4left" value= "FDSA" size= "8" readonly>
</td>
</tr>
<input Type=hidden name=processtimes value= "2" >
</table>
</body>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.