时间:2021-07-01 10:21:17 帮助过:38人阅读
- <br><html> <br><head> <br><script language="javascript"><!-- <br>var http_request; <br>function update(v){ <br>if (window.XMLHttpRequest) { // Mozilla, Safari, ... <br>http_request = new XMLHttpRequest(); <br>} else if (window.ActiveXObject) { // IE <br>http_request = new ActiveXObject("Microsoft.XMLHTTP"); <br>} <br>http_request.onreadystatechange=out; <br>var url="tp.phtml?worksheet="+v.value; <br>http_request.open('GET',url,true); <br>http_request.send(null); <br>} <br>function out(){ <br>if(http_request.readyState == 4){ <br>var div=document.getElementById('out'); <br>if(http_request.responseText!='') { <br>div.style.display='block'; <br>div.innerHTML=http_request.responseText; <br>//alert(div.innerHTML); <br>}else{ <br>div.style.display='none'; <br>div.innerHTML=''; <br>} <br>} <br>} <br>function end(val){ <br>document.getElementById('ws').value=val; <br>document.getElementById('out').innerHTML=''; <br>document.getElementById('out').style.display='none'; <br>} <br><br>// --></script> <br><style><!-- <br>.test{ <br>display:none; <br>z-index:100; <br>width:150px; <br>top:20px; <br>left:0px; <br>height:auto; <br>background-color:lightgrey; <br>border:1px solid; <br>position:absolute; <br>} <br>a:link { <br>text-decoration:none; <br>color:black; <br>} <br>a:visited { <br>text-decoration:none; <br>color:black; <br>} <br>a:hover { <br>text-decoration:none; <br>color:black; <br>} <br>--></style> <br></head> <br><body> <br><div style="position:relative;" style="position:relative;"> <br><input type='txt' id='ws' name='ws' value='' onPropertyChange='update(this);' oninput='update(this);'/> <div id='out' class='test'></div> <br><div> <br><input type='txt' id='d'/> <br></body> <br></html> <br> <br>页面一 <br><br><span><u></u></span> 代码如下:<pre class="brush:php;toolbar:false layui-box layui-code-view layui-code-notepad"><ol class="layui-code-ol"><li><br><? <br>include("include/db.inc"); <br>$ws=$_GET['worksheet']; <br>if(empty($ws)||strlen($ws)<3){ <br>//echo 'oo'; <br>exit(); <br>} <br>$db=new db(); <br>$str=''; <br>$sql="select * from user where deptID=10 and status='On' and worksheet like '%$ws%' order by worksheet"; <br>$rt=$db->rtAssoc($sql); <br>while($row=array_shift($rt)){ <br>$str.="<a href="\" href="\""#\" onclick=\"end('" <br>.$row['emp_name'].':'.$row['emp_worksheet']."');\">" <br>.$row['emp_name'].':'.$row['emp_worksheet'] <br>.'</a>,<br/>'; <br>} <br>$str=substr($str,0,-6); <br>echo trim($str); <br>exit(); <br>?> <br> <br>页面二。 <br><br>这个东西功能上模仿谷歌,但是效果很不理想。一般简单的应用可以满足</li><li> </li><li> </li></ol></pre>