jquery autoComplete一:autothink.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<html:html>
<HEAD>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="java.util.*"%>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String searchinfo="";
%>
<script src="<%=basePath%>js/jquery.autocomplete.js"></script>
<link href="<%=basePath%>css/jquery.autocomplete.css" rel="stylesheet" type="text/css">
<script type="text/javascript" language="javascript">
var root_url="<%=basePath%>";
function defineDocSearchInput()
{
//自动联想功能
initAutoThink();
var inputDocSearchVal = $("#inputProductSearch").val();
$("#inputProductSearch").blur(refreshDocSearchTipBlur);
$("#inputProductSearch").focus(refreshDocSearchTipFocus);
if (inputDocSearchVal == "<bean:message key='support.navigate.auto.think.inputInfo'/>")
{
$("#inputProductSearch").val("");
}
}
function refreshDocSearchTipFocus()
{
var inputDocSearchVal = $("#inputProductSearch").val();
if (inputDocSearchVal == "<bean:message key='support.navigate.auto.think.inputInfo'/>")
{
$("#inputProductSearch").val("");
}
}
function refreshDocSearchTipBlur()
{
var inputDocSearchVal = $("#inputProductSearch").val();
if (inputDocSearchVal == "" || null==inputDocSearchVal || 0==inputDocSearchVal.length)
{
$("#inputProductSearch").val("<bean:message key='support.navigate.auto.think.inputInfo'/>");
}
}
//解析json数据
function parseFn(data) {
var rows = [];
if(data==null)
return rows;
for(var i=0; i<data.length; i++){
rows[rows.length] = {
data:data[i],
result:data[i].PROLINE_NAME,
result:data[i].PROFAMILY_NAME,
result:data[i].PRODUCT_NAME,
result:data[i].ITEM_NAME
};
}
return rows;
}