<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[沧海一粟]]></title> 
<link>http://www.dzhope.com/index.php</link> 
<description><![CDATA[Web系统架构与服务器运维,php开发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[沧海一粟]]></copyright>
<item>
<link>http://www.dzhope.com/post//</link>
<title><![CDATA[php＋ajax实现搜索提示自动完成补充表单]]></title> 
<author>jed &lt;jed521@163.com&gt;</author>
<category><![CDATA[代码编程]]></category>
<pubDate>Fri, 10 Apr 2009 13:08:53 +0000</pubDate> 
<guid>http://www.dzhope.com/post//</guid> 
<description>
<![CDATA[ 
	大家都使用过google或者xunlei的搜索，输入关键字后可以出现相关提示，是个不错的功能，今天就在这里给大家把我的拙作给大家分享<br/><br/><a href="http://www.dzhope.com/attachment.php?fid=38" target="_blank"><img src="http://www.dzhope.com/attachment.php?fid=38" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>程序下载：<br/><a href="attachment.php?fid=39">点击这里下载文件</a><br/><br/><br/>数据库表：<br/><br/><div class="code"><br/><br/><br/>CREATE TABLE `xqbar`.`suggest` (<br/>`id` INT NOT NULL AUTO_INCREMENT ,<br/>`title` VARCHAR( 100 ) NOT NULL ,<br/>`hits` INT NOT NULL DEFAULT &#039;0&#039;,<br/>PRIMARY KEY ( `id` ) <br/>) ENGINE = InnoDB <br/><br/>insert into suggest(title,hits)values(&#039;dzhope.com&#039;,100);<br/>insert into suggest(title,hits)values(&#039;www.dzhope.com&#039;,410);<br/>insert into suggest(title,hits)values(&#039;http://dzhope.com&#039;,700);<br/>insert into suggest(title,hits)values(&#039;mail:dzhope.com&#039;,200);<br/>insert into suggest(title,hits)values(&#039;ftp:dzhope.com&#039;,100);<br/>insert into suggest(title,hits)values(&#039;http://www.dzhope.com&#039;,70)<br/><br/><br/></div><br/><br/><br/>search.php<br/>(关于php我也是接触不久，下面的php如果罗嗦还望高手指点)<br/>返回的信息字符串要为 xxx1&#124;xxx2$200&#124;100 前后对应 <br/><br/><div class="code"><br/><br/><br/>&lt;?php<br/>if($_GET&#91;&quot;action&quot;&#93;!=&#039;&#039;)&#123;<br/>&nbsp;&nbsp; #获取用户输入的关键字<br/>&nbsp;&nbsp; $keyword=$_GET&#91;&quot;keyword&quot;&#93;;<br/>&nbsp;&nbsp; #过滤关键字<br/>&nbsp;&nbsp; $keyword=str_replace(&quot;&#91;&quot;,&quot;&#91;&#91;&#93;&quot;,$keyword);<br/>&nbsp;&nbsp; $keyword=str_replace(&quot;&amp;&quot;,&quot;&#91;&amp;&#93;&quot;,$keyword);<br/>&nbsp;&nbsp; $keyword=str_replace(&quot;%&quot;,&quot;&#91;%&#93;&quot;,$keyword);<br/>&nbsp;&nbsp; $keyword=str_replace(&quot;^&quot;,&quot;&#91;^&#93;&quot;,$keyword);<br/>&nbsp;&nbsp; #链接数据库<br/>&nbsp;&nbsp; $conn=mysql_connect(&quot;localhost&quot;,&quot;xqbar&quot;,&quot;xqbaradmin&quot;);<br/>&nbsp;&nbsp; #选择数据库<br/>&nbsp;&nbsp; @mysql_select_db(&quot;xqbar&quot;) or die(&#039;sorry&#039;);<br/>&nbsp;&nbsp; mysql_query(&#039;set names utf-8&#039;);<br/>&nbsp;&nbsp; #查询语句<br/>&nbsp;&nbsp; $sql=&quot;select title,hits from suggest where title like &#039;%&quot;.$keyword.&quot;%&#039; order by hits desc limit 10&quot;;<br/>&nbsp;&nbsp; $result=mysql_query($sql);<br/>&nbsp;&nbsp; #循环得到查询结果，返回字符串<br/>&nbsp;&nbsp; #格式为 结果1&#124;结果2$结果1点击次数&#124;结果2点击次数<br/>&nbsp;&nbsp; if($result)&#123;<br/>&nbsp;&nbsp; $i=1;$title=&#039;&#039;;$hits=&#039;&#039;;<br/>&nbsp;&nbsp; while($row=mysql_fetch_array($result,MYSQL_BOTH))<br/>&nbsp;&nbsp; &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp; $title=$title.$row&#91;&#039;title&#039;&#93;;<br/>&nbsp;&nbsp; $hits=$hits.$row&#91;&#039;hits&#039;&#93;;<br/>&nbsp;&nbsp; if($i&lt;mysql_num_rows($result))<br/>&nbsp;&nbsp;&#123;<br/>&nbsp;&nbsp; $title=$title.&quot;&#124;&quot;;<br/>&nbsp;&nbsp; $hits=$hits.&quot;&#124;&quot;;<br/>&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;$i++;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp; &#125;<br/>&nbsp;&nbsp; mysql_close();<br/>&#125;<br/>?&gt;<br/>&lt;?php echo $title.&#039;$&#039;.$hits;?&gt;<br/><br/><br/></div><br/><br/>js代码 <br/><br/><div class="code"><br/><br/><br/><br/>引入prototye.js有朋友说这个库太大，或者把，不习惯的朋友可以使用jquery.js框架或者直接创建ajax对象，这个我就不想说了，这里直接引用prototye.js框架<br/>&lt;script type=&quot;text/javascript&quot; src=&quot;prototype.js&quot;&gt;&lt;/script&gt;<br/>创建层和显示查询结果的js代码<br/>&lt;script type=&quot;text/javascript&quot;&gt;<br/>//定义变量lastindex 表示为鼠标在查询结果上滑动所在位置，初始为-1<br/>var lastindex=-1;<br/>//定义变量flag 表示是否根据用户输入的关键字进行ajax查询,flase为允许查询 true为禁止查询<br/>var flag=false;<br/>//返回的查询结果生成的数组长度<br/>var listlength=0;<br/>//创建自定字符串，优化效率<br/>function StringBuffer()&#123;this.data=&#91;&#93;;&#125; <br/>//赋值<br/>StringBuffer.prototype.append=function()&#123;this.data.push(arguments&#91;0&#93;);return this;&#125; <br/>//输出<br/>StringBuffer.prototype.tostring=function()&#123;return this.data.join(&quot;&quot;);&#125; <br/>//去掉字符串两边空格<br/>String.prototype.Trim = function()&#123;return this.replace(/(^&#92;s*)&#124;(&#92;s*$)/g, &quot;&quot;);&#125;<br/>//隐藏函数 主要是隐藏显示的提示下拉层和iframe，关于iframe下面在说其作用<br/>function hiddensearch()<br/>&#123;<br/>$(&#039;rlist&#039;).style.display=&quot;none&quot;;<br/>$(&#039;rFrame&#039;).style.display=&quot;none&quot;;<br/>&#125;<br/>//显示函数 主要是显示的提示下拉层和iframe 参数num,根据该参数控制要显示提示层和iframe的高度<br/>function showsearch(num)<br/>&#123;<br/>&nbsp;&nbsp;$(&#039;rlist&#039;).style.display=&#039;&#039;;<br/>&nbsp;&nbsp;$(&#039;rFrame&#039;).style.display=&#039;&#039;;<br/>&nbsp;&nbsp;//这里我定义每个返回查询结果的提示高度为20px,其中提示层总高度又加了num,是因为我在定义样式时使用了padding一个像素<br/>&nbsp;&nbsp;$(&#039;rlist&#039;).style.height=num*20+num+&#039;px&#039;;<br/>&nbsp;&nbsp;//同样定位iframe的高度<br/>&nbsp;&nbsp;$(&#039;rFrame&#039;).style.height=num*20+num+&#039;px&#039;;<br/>&#125;<br/>//返回文本输入框的坐标函数，参数element为要返回的对象,参数offset可选为offsetLeft&#124;offsetTop 分别表示为该对象距离左窗口上角的绝对位置<br/>//利用这个函数可以定位我们要显示的提示层位置，使提示层正确的显示在文本输入框下面<br/>function getposition(element,offset)<br/>&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;var c=0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;while(element)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c+=element&#91;offset&#93;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;element=element.offsetParent<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;return c;<br/>&#125;<br/>//创建提示层函数 包括提示层和为了避免在文本输入框下面出现select下拉选框时我们的提示层不能再select之上的iframe<br/>//可以理解为当文本输入框下有select下拉选框时从底向上依次为 select下拉选框-iframe-提示层<br/>function createlist()<br/>&#123;<br/>//创建提示层<br/>var listDiv=document.createElement(&quot;div&quot;);<br/>//提示层id<br/>listDiv.id=&quot;rlist&quot;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>listDiv.style.zIndex=&quot;2&quot;;<br/>listDiv.style.position=&quot;absolute&quot;; <br/>listDiv.style.border=&quot;solid 1px #000000&quot;;<br/>listDiv.style.backgroundColor=&quot;#FFFFFF&quot;;<br/>listDiv.style.display=&quot;none&quot;; <br/>listDiv.style.width=$(&#039;keyword&#039;).clientWidth+&quot;px&quot;;<br/>listDiv.style.left=getposition($(&#039;keyword&#039;),&#039;offsetLeft&#039;)+1.5+&quot;px&quot;;<br/>listDiv.style.top =(getposition($(&#039;keyword&#039;),&#039;offsetTop&#039;)+$(&#039;keyword&#039;).clientHeight +3)+&quot;px&quot;;<br/><br/>var listFrame=document.createElement(&quot;iframe&quot;);<br/>listFrame.id=&quot;rFrame&quot;;<br/>listFrame.style.zIndex=&quot;1&quot;;<br/>listFrame.style.position=&quot;absolute&quot;;<br/>listFrame.style.border=&quot;0&quot;;<br/>listFrame.style.display=&quot;none&quot;; <br/>listFrame.style.width=$(&#039;keyword&#039;).clientWidth+&quot;px&quot;;<br/>listFrame.style.left=getposition($(&#039;keyword&#039;),&#039;offsetLeft&#039;)+1+&quot;px&quot;;<br/>listFrame.style.top =(getposition($(&#039;keyword&#039;),&#039;offsetTop&#039;)+$(&#039;keyword&#039;).clientHeight +3)+&quot;px&quot;;<br/>document.body.appendChild(listDiv);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>document.body.appendChild(listFrame);<br/>&#125;<br/>function setstyle(element,classname)<br/>&#123;<br/>switch (classname)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp; case &#039;m&#039;:<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; element.style.fontSize=&quot;12px&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.fontFamily=&quot;arial,sans-serif&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.backgroundColor=&quot;#3366cc&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.color=&quot;black&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.width=$(&#039;keyword&#039;).clientWidth-2+&quot;px&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.height=&quot;20px&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;element.style.padding=&quot;1px 0px 0px 2px&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(element.displaySpan)element.displaySpan.style.color=&quot;white&quot;<br/>&nbsp;&nbsp;&nbsp;&nbsp;break;<br/>&nbsp;&nbsp;&nbsp;&nbsp; case &#039;d&#039;:<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; element.style.fontSize=&quot;12px&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.fontFamily=&quot;arial,sans-serif&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.backgroundColor=&quot;white&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.color=&quot;black&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.width=$(&#039;keyword&#039;).clientWidth-2+&quot;px&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.height=&quot;20px&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;element.style.padding=&quot;1px 0px 0px 2px&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(element.displaySpan)element.displaySpan.style.color=&quot;green&quot;<br/>&nbsp;&nbsp;&nbsp;&nbsp;break;<br/>&nbsp;&nbsp;case &#039;t&#039;:<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; element.style.width=&quot;80%&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;if(window.navigator.userAgent.toLowerCase().indexOf(&quot;firefox&quot;)!=-1)element.style.cssFloat=&quot;left&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;else element.style.styleFloat=&quot;left&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.whiteSpace=&quot;nowrap&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.overflow=&quot;hidden&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.textOverflow=&quot;ellipsis&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.fontSize=&quot;12px&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.textAlign=&quot;left&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;break;<br/>&nbsp;&nbsp;case &#039;h&#039;:<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; element.style.width=&quot;20%&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;if(window.navigator.userAgent.toLowerCase().indexOf(&quot;firefox&quot;)!=-1)element.style.cssFloat=&quot;right&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;else element.style.styleFloat=&quot;right&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.textAlign=&quot;right&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;element.style.color=&quot;green&quot;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;break;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&#125;<br/>function focusitem(index)<br/>&#123;<br/>&nbsp;&nbsp;if($(&#039;item&#039;+lastindex)!=null)setstyle($(&#039;item&#039;+lastindex),&#039;d&#039;);<br/>&nbsp;&nbsp;if($(&#039;item&#039;+index)!=null)<br/>&nbsp;&nbsp;&#123;<br/>&nbsp;&nbsp; setstyle($(&#039;item&#039;+index), &#039;m&#039;);<br/>&nbsp;&nbsp; lastindex=index;<br/>&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;else $(&quot;keyword&quot;).focus();<br/>&#125;<br/>function searchclick(index)<br/>&#123;<br/>&nbsp;&nbsp;$(&quot;keyword&quot;).value=$(&#039;title&#039;+index).innerHTML;<br/>&nbsp;&nbsp;flag=true;<br/>&#125;<br/>function searchkeydown(e)<br/>&#123;<br/>if($(&#039;rlist&#039;).innerHTML==&#039;&#039;)return;<br/>&nbsp;&nbsp;var keycode=(window.navigator.appName==&quot;Microsoft Internet Explorer&quot;)?event.keyCode:e.which;<br/>&nbsp;&nbsp;//down<br/>&nbsp;&nbsp;if(keycode==40)<br/>&nbsp;&nbsp;&#123;<br/>if(lastindex==-1&#124;&#124;lastindex==listlength-1)<br/>&#123;<br/>&nbsp;&nbsp;focusitem(0);<br/>&nbsp;&nbsp;searchclick(0);<br/>&#125;<br/>else&#123;<br/>&nbsp;&nbsp;focusitem(lastindex+1);<br/>&nbsp;&nbsp;searchclick(lastindex+1);<br/>&#125;<br/>&nbsp;&nbsp;&#125;<br/>if(keycode==38)<br/>&#123;<br/>if(lastindex==-1)<br/>&#123;<br/>&nbsp;&nbsp;focusitem(0);<br/>&nbsp;&nbsp;searchclick(0);<br/>&#125;<br/>else&#123;<br/>&nbsp;&nbsp;focusitem(lastindex-1);<br/>&nbsp;&nbsp;searchclick(lastindex-1);<br/>&#125;<br/>&#125;<br/>if(keycode==13)<br/>&#123;<br/>&nbsp;&nbsp;focusitem(lastindex);<br/>&nbsp;&nbsp;$(&quot;keyword&quot;).value=$(&#039;title&#039;+lastindex).innerText;<br/>&#125;&nbsp;&nbsp;&nbsp;&nbsp;<br/>if(keycode==46&#124;&#124;keycode==8)&#123;flag=false;ajaxsearch($F(&#039;keyword&#039;).substring(0,$F(&#039;keyword&#039;).length-1).Trim());&#125;<br/>&#125;<br/>function showresult(xmlhttp)<br/>&#123;<br/>var result=unescape(xmlhttp.responseText);<br/>if(result!=&#039;&#039;)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;var resultstring=new StringBuffer();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var title=result.split(&#039;$&#039;)&#91;0&#93;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var hits=result.split(&#039;$&#039;)&#91;1&#93;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;for(var i=0;i&lt;title.split(&#039;&#124;&#039;).length;i++)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;resultstring.append(&#039;&lt;div id=&quot;item&#039;+i+&#039;&quot; onmousemove=&quot;focusitem(&#039;+i+&#039;)&quot; onmousedown=&quot;searchclick(&#039;+i+&#039;)&quot;&gt;&#039;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;resultstring.append(&#039;&lt;span id=title&#039;+i+&#039;&gt;&#039;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;resultstring.append(title.split(&#039;&#124;&#039;));<br/>&nbsp;&nbsp;&nbsp;&nbsp;resultstring.append(&#039;&lt;/span&gt;&#039;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;resultstring.append(&#039;&lt;span id=hits&#039;+i+&#039;&gt;&#039;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;resultstring.append(hits.split(&#039;&#124;&#039;));<br/>&nbsp;&nbsp;&nbsp;&nbsp;resultstring.append(&#039;&lt;/span&gt;&#039;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;resultstring.append(&#039;&lt;/div&gt;&#039;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$(&#039;rlist&#039;).innerHTML=resultstring.tostring();<br/>&nbsp;&nbsp;&nbsp;&nbsp;for(var j=0;j&lt;title.split(&#039;&#124;&#039;).length;j++)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp; setstyle($(&#039;item&#039;+j),&#039;d&#039;);<br/>&nbsp;&nbsp;$(&#039;item&#039;+j).displaySpan=$(&#039;hits&#039;+j);<br/>&nbsp;&nbsp;&nbsp;&nbsp; setstyle($(&#039;title&#039;+j),&#039;t&#039;);<br/>&nbsp;&nbsp;&nbsp;&nbsp; setstyle($(&#039;hits&#039;+j),&#039;h&#039;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;showsearch(title.split(&#039;&#124;&#039;).length);<br/>&nbsp;&nbsp;&nbsp;&nbsp;listlength=title.split(&#039;&#124;&#039;).length;<br/>&nbsp;&nbsp;&nbsp;&nbsp;lastindex=-1;<br/>&#125;<br/>else hiddensearch();<br/>&#125;<br/>function ajaxsearch(value)<br/>&#123;<br/>new Ajax.Request(&#039;search.php&#039;,&#123;method:&quot;get&quot;,parameters:&quot;action=do&amp;keyword=&quot;+escape(value),onComplete:showresult&#125;);<br/>&#125;<br/>function main()<br/>&#123;<br/>$(&#039;keyword&#039;).className=$(&#039;keyword&#039;).className==&#039;inputblue&#039;?&#039;inputfocus&#039;:&#039;inputblue&#039;;<br/>if($F(&#039;keyword&#039;).Trim()==&#039;&#039;)hiddensearch();<br/>else<br/>&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($F(&#039;keyword&#039;)!=&#039;&#039;&amp;&amp;flag==false)ajaxsearch($F(&#039;keyword&#039;).Trim());<br/>&nbsp;&nbsp; if(listlength!=0)$(&#039;keyword&#039;).onkeydown=searchkeydown;<br/>&nbsp;&nbsp; else hiddensearch();<br/>&#125;<br/>&#125;<br/>function oninit()<br/>&#123;<br/>$(&#039;keyword&#039;).autocomplete=&quot;off&quot;;<br/>$(&#039;keyword&#039;).onfocus=main;<br/>$(&#039;keyword&#039;).onkeyup=main;<br/>$(&#039;keyword&#039;).onblur=hiddensearch; <br/>createlist();<br/>&#125;<br/>Event.observe(window,&#039;load&#039;,oninit);<br/>&lt;/script&gt;<br/><br/><br/></div><br/><br/>具体可以下载程序包看一下，调试一下，有不懂的可以留言。<br/><br/>Tags - <a href="http://www.dzhope.com/tags/ajax/" rel="tag">ajax</a> , <a href="http://www.dzhope.com/tags/php/" rel="tag">php</a> , <a href="http://www.dzhope.com/tags/%25E6%2590%259C%25E7%25B4%25A2%25E6%258F%2590%25E7%25A4%25BA/" rel="tag">搜索提示</a> , <a href="http://www.dzhope.com/tags/%25E8%2587%25AA%25E5%258A%25A8%25E8%25A1%25A5%25E5%2585%2585/" rel="tag">自动补充</a>
]]>
</description>
</item><item>
<link>http://www.dzhope.com/post//#blogcomment</link>
<title><![CDATA[[评论] php＋ajax实现搜索提示自动完成补充表单]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.dzhope.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>