当前位置: 代码迷 >> Web前端 >> jquery - tags 百度式样的动态提示
  详细解决方案

jquery - tags 百度式样的动态提示

热度:301   发布时间:2012-10-27 10:42:26.0
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);
%>
  相关解决方案