Copy Code code as follows:
<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>
<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>
Page One
Copy Code code 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= ' in ' 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 two.
This thing functions like Google, but the effect is not ideal. General simple application can satisfy