zoukankan      html  css  js  c++  java
  • jquery autocomplete文本自己主动补全

    文本自己主动补全功能确实非常有用。

    先看下简单的效果:(样式不咋会写)

    以下介绍几种:
    1:jqery-actocomplete.js
    这个网上有个写好的实例,上面挺具体的,能够下来执行下就清楚了就不多做解释
    地址:http://download.csdn.net/detail/linlinv3/7744717(假设找不到资源留言找我)
    2:jquery-ui.js
    jquery-ui.js一般系统中用,所以用这个也比較方便。注意引入包的顺序

    <link href="jquery/jquery-ui.css" rel='stylesheet' type="text/css"/>
    <script type="text/javasrcipt">jquery/jquery-1.7.1.min.js</script>
    <script type="text/javasrcipt">jquery/jquery-ui.js</script>
    
    <input type="text" name="address" width="200" />
    
    <script type="text/javasrcipt">
    jQuery(function($)){
        $("input[name=address]").autocomplete({
    	delay: 100, //延长多少秒激活
    	minLength:1, //最小多少个字符触发
    	autoFocus:true, //是否选中第一个
    	source:function(request,response){
    		var data = new Array();
    		data.pust("ss");
    		//......
    		response(data); //在文本中要提示的数据
    	}
        
        });
    
    }
    </script>
    
    个人比較喜欢用ui的,这个数据动态写入比較方便,能够在var data那写ajax等来去数据啥的。
    上面的还能够加改样式
    <style>
    .ui-autocomplete{
    	max-height:300px; //显示框最大高度
    	overflow-y:auto;  //竖向滚动栏
    	overflow-x:auto;  //横向滚动栏
    }
    html.ui-autocomplete{
    	height:100px; 
    }
    </style>

    样例比較简单个人感觉非常有用。能够亲自己主动手试试,欢迎交流

  • 相关阅读:
    python 编码格式
    mysql 允许特定IP访问
    mysql “Too many connections” 解决办法
    python 微信支付
    python RSA 加密与签名
    给列表里添加字典时被最后一个覆盖
    设置MySQL允许外网访问
    Python中print/format字符串格式化实例
    ssh 将22端口换为其它 防火墙设置
    linux ubuntu nethogs安装与介绍
  • 原文地址:https://www.cnblogs.com/brucemengbm/p/6958694.html
Copyright © 2011-2022 走看看