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>
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.