jquery.autocomplete

jquery.autocomplete

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript" src="../lib/jquery.js"></script>
<script type='text/javascript' src='../jquery.autocomplete.js'></script>
<link rel="stylesheet" type="text/css" href="../jquery.autocomplete.css" />
<script type="text/javascript">
$(document).ready(function() {
 $("#tags").autocomplete(["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "pearl"], {
  width: 320,
  max: 4,
  highlight: false,
  multiple: true,
  multipleSeparator: " ",
  scroll: true,
  scrollHeight: 300
 });
 
  $("#imageSearch").autocomplete("data.html", {
  width: 320,
  max: 40,
  highlight: false,
  scroll: true,
  scrollHeight: 300,
  formatItem: function(data, i, n, value) {
   return "<img src='images/" + value + "'/> " + data+'-'+'-'+i+'-'+n+'-'+value+'-'+value.split(".")[0];
  },
  formatResult: function(data, value) {
   return value.split(".")[0];
  }
 });
 
 });
</script>
</head>

<body>
<input type="text" id='tags' />
<br />
<input type="text" id='imageSearch' />
</body>
</html>

你可能感兴趣的:(jquery.autocomplete)