jQuery AutoComplete 自動補全

來源:互聯網
上載者:User

標籤:

html 代碼:

<!DOCTYPE HTML><html><head>    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />    <title>Demo For AutoComplete.js</title>    <script type="text/javascript" src="http://ku.shouce.ren/libs/jquery/1/jquery1.8.3.min.js"></script>    <link rel="stylesheet" type="text/css" href="//ku.shouce.ren/libs/autoComplete/css/jquery.autocomplete.css">    <script type="text/javascript" src="//ku.shouce.ren/libs/autoComplete/js/jquery.autocomplete.min.js"></script>    <script src="//shouce.ren/static/demo/autoComplete/test.js"></script>    <style type="text/css">        body {            margin: 0px;            background: #f4f4f4;            font-family: Helvetica Neue, Helvetica, Arial;        }    </style>    <script type="text/javascript">        $(document).ready(function(){            $(‘#down‘).AutoComplete({                ‘data‘: [‘One‘, ‘Two‘, ‘Three‘, ‘Four‘, ‘Five‘, ‘Six‘, ‘Seven‘, ‘Eight‘, ‘Nine‘, ‘Ten‘, ‘Eleven‘, ‘Twelve‘],                ‘itemHeight‘: 20,                ‘width‘: 280            }).AutoComplete(‘show‘);            $(‘#up‘).AutoComplete({                ‘data‘: [‘One‘, ‘Two‘, ‘Three‘, ‘Four‘, ‘Five‘, ‘Six‘, ‘Seven‘, ‘Eight‘, ‘Nine‘, ‘Ten‘, ‘Eleven‘, ‘Twelve‘],                ‘itemHeight‘: 20,                ‘listDirection‘: ‘up‘,                ‘width‘: 280            }).AutoComplete(‘show‘);            var teams = [{                            ‘label‘: ‘江蘇舜天隊‘,                            ‘value‘: ‘江蘇舜天隊‘,                            ‘win‘: 14,                            ‘tie‘: 9,                            ‘lose‘: 3,                            ‘score‘: 51                        },{                            ‘label‘: ‘廣州恒大隊‘,                            ‘value‘: ‘廣州恒大隊‘,                            ‘win‘: 15,                            ‘tie‘: 6,                            ‘lose‘: 5,                            ‘score‘: 51                        },{                            ‘label‘: ‘廣州富力隊‘,                            ‘value‘: ‘廣州富力隊‘,                            ‘win‘: 13,                            ‘tie‘: 2,                            ‘lose‘: 11,                            ‘score‘: 41                        },{                            ‘label‘: ‘北京國安隊‘,                            ‘value‘: ‘北京國安隊‘,                            ‘win‘: 12,                            ‘tie‘: 5,                            ‘lose‘: 9,                            ‘score‘: 41                        },{                            ‘label‘: ‘貴州人和隊‘,                            ‘value‘: ‘貴州人和隊‘,                            ‘win‘: 10,                            ‘tie‘: 7,                            ‘lose‘: 9,                            ‘score‘: 37                        },{                            ‘label‘: ‘天津泰達隊‘,                            ‘value‘: ‘天津泰達隊‘,                            ‘win‘: 9,                            ‘tie‘: 8,                            ‘lose‘: 9,                            ‘score‘: 35                        },{                            ‘label‘: ‘長春亞泰隊‘,                            ‘value‘: ‘長春亞泰隊‘,                            ‘win‘: 9,                            ‘tie‘: 8,                            ‘lose‘: 9,                            ‘score‘: 35                        },{                            ‘label‘: ‘上海申花隊‘,                            ‘value‘: ‘上海申花隊‘,                            ‘win‘: 7,                            ‘tie‘: 13,                            ‘lose‘: 6,                            ‘score‘: 34                        },{                            ‘label‘: ‘大連阿爾濱隊‘,                            ‘value‘: ‘大連阿爾濱隊‘,                            ‘win‘: 8,                            ‘tie‘: 10,                            ‘lose‘: 8,                            ‘score‘: 34                        },{                            ‘label‘: ‘山東魯能隊‘,                            ‘value‘: ‘山東魯能隊‘,                            ‘win‘: 7,                            ‘tie‘: 10,                            ‘lose‘: 9,                            ‘score‘: 31                        },{                            ‘label‘: ‘大連實德隊‘,                            ‘value‘: ‘大連實德隊‘,                            ‘win‘: 7,                            ‘tie‘: 10,                            ‘lose‘: 9,                            ‘score‘: 31                        },{                            ‘label‘: ‘青島中能隊‘,                            ‘value‘: ‘青島中能隊‘,                            ‘win‘: 8,                            ‘tie‘: 6,                            ‘lose‘: 12,                            ‘score‘: 30                        },{                            ‘label‘: ‘遼寧宏運隊‘,                            ‘value‘: ‘遼寧宏運隊‘,                            ‘win‘: 6,                            ‘tie‘: 11,                            ‘lose‘: 9,                            ‘score‘: 29                        },{                            ‘label‘: ‘杭州綠城隊‘,                            ‘value‘: ‘杭州綠城隊‘,                            ‘win‘: 7,                            ‘tie‘: 8,                            ‘lose‘: 11,                            ‘score‘: 29                        },{                            ‘label‘: ‘上海申鑫隊‘,                            ‘value‘: ‘上海申鑫隊‘,                            ‘win‘: 5,                            ‘tie‘: 11,                            ‘lose‘: 10,                            ‘score‘: 26                        },{                            ‘label‘: ‘河南建業隊‘,                            ‘value‘: ‘河南建業隊‘,                            ‘win‘: 7,                            ‘tie‘: 4,                            ‘lose‘: 15,                            ‘score‘: 25                        }];            $.each(teams, function(index, data){                new Image().src = ‘//ku.shouce.ren/libs/autoComplete/img/2012中超/‘ + data[‘value‘] + ‘.jpg‘; // 預先載入圖片                data[‘image‘] = ‘//ku.shouce.ren/libs/autoComplete/img/2012中超/‘ + data[‘value‘] + ‘.jpg‘;            });            $(‘#custom‘).AutoComplete({                ‘data‘: teams,                ‘width‘:280,                ‘listStyle‘: ‘custom‘,                ‘maxHeight‘: 480,                ‘createItemHandler‘: function(index, data){                    var div = $("<div></div>")                    var cell1 = $("<div style=‘display:table-cell;vertical-align:top;‘></div>").appendTo(div);                    var cell1_1 = $("<img style=‘width:32px;height:32px;‘></img>").attr(‘src‘, data.image).appendTo(cell1);                    var cell2 = $("<div style=‘display:table-cell;vertical-align:top;‘></div>").appendTo(div);                    var cell2_1 = $("<div></div>").append(data.label).appendTo(cell2);                    var cell2_2 = $("<div style=‘vertical-align:top;‘></div>")                                .append("<div style=‘display:table-cell;width:40px;‘>勝:"+data.win+"</span>")                                .append("<div style=‘display:table-cell;width:40px;‘>平:"+data.tie+"</span>")                                .append("<div style=‘display:table-cell;width:40px;‘>負:"+data.lose+"</span>")                                .append("<div style=‘display:table-cell;width:40px;‘>積:"+data.score+"</span>")                                .appendTo(cell2);                    return div;                }            }).AutoComplete(‘show‘);            alltest.testIconList(‘#iconlist‘);            $(‘#iconlist‘).AutoComplete(‘show‘);        });    </script></head><body>    <div style="background-color:black;height:40px;margin-bottom:10px;"><div style="width:1000px;margin:auto;height:100%;color:white;"><span style="font-size:20px;line-height:40px;">jQuery.AutoComplete 自動補全外掛程式</span></div>    </div>    <div style="width:1000px;margin:auto;">        <div style="display:table-cell;">            <div style="height:503px;width:330px;">                <input type="text" id="down" value="e"></input><span style="font-weight:bold;font-size:13px;">補全列表在下方</span>            </div>            <div>                <input type="text" id="up" value="e"></input><span style="font-weight:bold;font-size:13px;">補全列表在上方</span>            </div></div>        <div style="display:table-cell;width:330px;">            <input type="text" id="iconlist" value="c"></input><span style="font-weight:bold;font-size:13px;">表徵圖文本樣式</span>        </div>        <div style="display:table-cell;width:330px;">            <input type="text" id="custom" value="隊"></input><span style="font-weight:bold;font-size:13px;">自訂樣式</span>        </div>    </div></body></html>

  

jQuery AutoComplete 自動補全

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.