简单的搜索框页面功能的实现(代码如下)
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
My JSP 'search.jsp' starting page//声明计数变量
var count=-1;
//声明变量记录定时执行的编码
var id;
//页面加载成功时完成页面资源的初始化
$(function(){
//给搜索框添加键盘弹起事件
$("#search").keyup(function(event){
//声明正则表达式判断空格
var reg = /^\s+$/g;
//获取event对象
var eve = window.event||event;
//获取用户当前点击的键盘键的键盘值
var code = eve.keyCode;
if((code>=65&&code<=90)||code==8 ||code==32){
//获取当前搜索框中的数据
var sd = $("#search").val();
if(sd==""||reg.test(sd)){
retur