jqueryui的autocomplete一个简单例子
来源:互联网 发布:查股网ddx日线数据 编辑:程序博客网 时间:2024/05/23 15:39
js部分:
<script>
$(function() {//var mydata=[{"label": "abd", "value": "cnblogs"}, {"label": "acx", "value": "囧月"}];
$( "#tags" ).autocomplete({
source: function(request,response){
$.ajax({
autoFocus:true,
url:"../GiveMyTip",
dataType:"json",
data:{
name:request.term
},
success:function(data){
response(data);
}
});
}
});
});
//进行表单的提交,并指定当前的iframe
function togive() {
var dept=$("#tags").val();
var url="<%=basePath%>DeptAction?dept="+dept;
$("#topingyin").attr("target","myiframe");
$("#topingyin").attr("action",url).submit();
}
</script>
Html部分:
<div class="ui-widget" style ="width:290px;height:33px;float:left;">
<label for="tags" style="line-height:33px; font-weight:400;">Tags: </label>
<input id="tags" style="line-height:25px;">
<div style="background-color:#CCC; float:right; width:76px;margin-top:3px; height:27px; line-height:28px; font-weight:400;">
<a target="myiframe" onClick="togive()">搜索</a>
<form id="topingyin" method="post" ></form>
</div>
</div>
<div style="float:left; width:85%; height:768px;">
<iframe style="margin:o auto; width:100%; height:768px; margin:0 auto;" name="myiframe">
hhhhhdhhd
</iframe>
</div>
jsp的后台部分:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
String name=request.getParameter("name");
System.out.println(name);
PrintWriter out=response.getWriter();
List<String> list=new ArrayList<String>();
for(ToolString e:py.testEnum(name)){
list.add(e.getName());
}
StringBuilder strbulider=new StringBuilder();
strbulider.append("[\"");
for(int i=0;i<list.size();i++){
strbulider.append(list.get(i));
if(i!=list.size()-1){
strbulider.append("\",\"");
}
}
strbulider.append("\"]");
System.out.println(strbulider.toString());
out.print(strbulider.toString());
}
- jqueryui的autocomplete一个简单例子
- jQueryUI-autocomplete的使用
- 一个简单的 autocomplete 文本框自动填充 例子
- AJAX AutoComplete简单的小例子
- http://jqueryui.com/autocomplete/
- JQueryUI之Autocomplete
- jQuery autocomplete 的例子
- 自己做的jquery的autocomplete的一个例子
- JQueryUI的autocomplete调用远程数据(ashx和webservice)
- jqueryui autoComplete 组合下拉框过长问题的解决
- 自动补全 jqueryUi 的autocomplete部件,中文不灵敏问题
- 一个简单的例子
- 简单的Autocomplete
- 关于autocomplete的小例子
- openmp 例子:一个简单的OpenMP例子
- 一个简单的Struts例子
- 一个简单的Hibernate例子!
- auto_ptr的一个简单例子
- Memcache的容量设置
- 线性表
- JS事件冒泡
- IOS设计模式学习 生成器
- 将窗口居中显示
- jqueryui的autocomplete一个简单例子
- Python宝典第22章:Python扩展和嵌入
- 【UMvp】1.Unity3d开源代码框架UMvp基础介绍
- hdoj_1007Quoit Design_最近点对(分治)
- Python监控Windows下的文件变化
- 感悟
- Kd-tree
- Storm-源码分析- Scheduler (backtype.storm.scheduler)
- 黑马程序员 C语言-枚举,结构体,指针