<input type="text" ></input>
<input type="button" style="background-color:#FFD7D7" value="搜索"></input>
<script type="text/javascript">
$(function(){
$("input[type=button]").click(function(){
var txt=$("input[type=text]").val();
if($.trim(txt)!=""){
$("table tr:not('#theader')").hide().filter(":contains('"+txt+"')").show().css("background","#FFD7D7");
}else{
$("table tr:not('#theader')").css("background","#fff").show();
}
});})</script>
可以使用数据库,将搜索频率较高的词入库,页面查询数据库展示
看你想要什么效果,效果好点,旁边加一个标签,想简单一点直接$("#inputID").attr("placeholder","你想要加的关键词");
页面上可以使用datalist标签,然后从后台获取热搜数据