jquery - tags 百度样式的动态提示
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
<head>
<title>jQuery UI Autocomplete - Default functionality</title>
<link rel="stylesheet" href="jquery-css/jquery.ui.all.css"/>
<script src="jquery-js/jquery-1.4.2.js"></script>
<script src="jquery-js/jquery.ui.core.js"></script>
<script src="jquery-js/jquery.ui.widget.js"></script>
<script src="jquery-js/jquery.ui.position.js"></script>
<script src="jquery-js/jquery.ui.autocomplete.js"></script>
<script type="text/javascript">
$(function() {
$.ajax({
type: "post",
url: "demoTags.jsp",
data: "",
success: function(msg){
var tags = msg.split('|');
$( "#tags" ).autocomplete({
source: tags
});
}
});
// end jquery label
});
</script>
</head>
<body>
<div class="demo">
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags" />
</div>
</div><!-- End demo -->
</body>
</html>
demoTags.jsp
<%
System.out.println("****************************");
String str = "aaaa|aabbb|bbbbb|cccccc|dddddd";
out.print(str);
%>