Copy codeThe Code is as follows:
<Html>
<Head>
<Script language = "javascript"> <! --
Var http_request;
Function update (v ){
If (window. XMLHttpRequest) {// Mozilla, Safari ,...
Http_request = new XMLHttpRequest ();
} Else if (window. ActiveXObject) {// IE
Http_request = new ActiveXObject ("Microsoft. XMLHTTP ");
}
Http_request.onreadystatechange = out;
Var url = "tp. phtml? Worksheet = "+ v. value;
Http_request.open ('get', url, true );
Http_request.send (null );
}
Function out (){
If (http_request.readyState = 4 ){
Var div = document. getElementById ('out ');
If (http_request.responseText! = ''){
Div. style. display = 'block ';
Div. innerHTML = http_request.responseText;
// Alert (div. innerHTML );
} Else {
Div. style. display = 'none ';
Div. innerHTML = '';
}
}
}
Function end (val ){
Document. getElementById ('ws '). value = val;
Document. getElementById ('out'). innerHTML = '';
Document. getElementById ('out'). style. display = 'none ';
}
// --> </Script>
<Style> <! --
. Test {
Display: none;
Z-index: 100;
Width: 150px;
Top: 20px;
Left: 0px;
Height: auto;
Background-color: lightgrey;
Border: 1px solid;
Position: absolute;
}
A: link {
Text-decoration: none;
Color: black;
}
A: visited {
Text-decoration: none;
Color: black;
}
A: hover {
Text-decoration: none;
Color: black;
}
--> </Style>
</Head>
<Body>
<Div style = "position: relative;" style = "position: relative;">
<Input type = 'txt 'id = 'ws 'name = 'ws' value = ''onpropertychange = 'Update (this); 'oninput = 'Update (this ); '/> <div id = 'out' class = 'test'> </div>
<Div>
<Input type = 'txt 'id = 'D'/>
</Body>
</Html>
Page 1
Copy codeThe Code is as follows:
<?
Include ("include/db. inc ");
$ Ws = $ _ GET ['worksheet '];
If (empty ($ ws) | strlen ($ ws) <3 ){
// Echo 'oo ';
Exit ();
}
$ Db = new db ();
$ Str = '';
$ SQL = "select * from user where deptID = 10 and status = 'on' and worksheet like '% $ ws %' order by worksheet ";
$ Rt = $ db-> rtAssoc ($ SQL );
While ($ row = array_shift ($ rt )){
$ Str. = "<a href =" \ "href =" \ "" # \ "onclick = \" end ('"
. $ Row ['EMP _ name']. ':'. $ row ['EMP _ worksheet ']. "'); \">"
. $ Row ['emp_name']. ':'. $ row ['emp_worksheet ']
. '</A>, <br/> ';
}
$ Str = substr ($ str, 0,-6 );
Echo trim ($ str );
Exit ();
?>
Page 2.
This feature imitates Google, but the effect is not ideal. Generally, simple applications can meet