Auto Complete,autocomplete

來源:互聯網
上載者:User

Auto Complete,autocomplete

一個很好用的AutoComplete js:

https://twitter.github.io/typeahead.js/


這裡是自己測試的一些demo:


<script src="jquery-1.11.1.min.js"></script><script src="typeahead.bundle.js"></script><script src="handlebars-v1.3.0.js"></script><p>1.Basic</p><div id="the-basics">  <input class="typeahead" type="text" placeholder="States of USA"></div><script>var substringMatcher_basic = function(strs) {  return function findMatches(q, cb) {    var matches, substrRegex;     // an array that will be populated with substring matches    matches = [];     // regex used to determine if a string contains the substring `q`    substrRegex = new RegExp(q, 'i');     // iterate through the pool of strings and for any string that    // contains the substring `q`, add it to the `matches` array    $.each(strs, function(i, str) {      if (substrRegex.test(str)) {        // the typeahead jQuery plugin expects suggestions to a        // JavaScript object, refer to typeahead docs for more info        matches.push({ value: str });      }    });     cb(matches);  };}; var _data_states_basic = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California',  'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii',  'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana',  'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',  'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire',  'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota',  'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island',  'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont',  'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming']; $('#the-basics .typeahead').typeahead({  hint: true,  highlight: true,  minLength: 1},{  name: 'states',  displayKey: 'value',  source: substringMatcher_basic(_data_states_basic)});</script><p>2.Using Bloodhound</p><div id="bloodhound">  <input class="typeahead" type="text" placeholder="States of USA"></div><script>var _data_states_bloodhound = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California',  'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii',  'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana',  'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',  'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire',  'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota',  'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island',  'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont',  'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'];var states_bloodhound = new Bloodhound({  datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),  queryTokenizer: Bloodhound.tokenizers.whitespace,  local: $.map(_data_states_bloodhound, function(state) { return { value: state }; })}); // kicks off the loading/processing of `local` and `prefetch`states_bloodhound.initialize(); $('#bloodhound .typeahead').typeahead({  hint: true,  highlight: true,  minLength: 1},{  name: 'states',  displayKey: 'value',  // `ttAdapter` wraps the suggestion engine in an adapter that  // is compatible with the typeahead jQuery plugin  source: states_bloodhound.ttAdapter()});</script><p>3. Pre-fetch (need to replace json URL)</p><div id="prefetch">  <input class="typeahead" type="text" placeholder="Countries"></div><script>var prefetch_countries = new Bloodhound({  datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),  queryTokenizer: Bloodhound.tokenizers.whitespace,  limit: 10,  prefetch: {    url: 'your json url here',    filter: function(list) {      return $.map(list, function(country) { return { name: country }; });    }  }}); // kicks off the loading/processing of `local` and `prefetch`prefetch_countries.initialize(); // passing in `null` for the `options` arguments will result in the default// options being used$('#prefetch .typeahead').typeahead(null, {  name: 'prefetch_countries',  displayKey: 'name',  // `ttAdapter` wraps the suggestion engine in an adapter that  // is compatible with the typeahead jQuery plugin  source: prefetch_countries.ttAdapter()});</script><p>4.Custom Template</p><style>#custom-templates .empty-message {  padding: 5px 10px; text-align: center;}</style><div id="custom-templates">  <input class="typeahead" type="text" placeholder="Oscar winners for Best Picture"></div><script>var _data_states_template_countries = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California',  'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii',  'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana',  'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',  'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire',  'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota',  'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island',  'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont',  'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'];var custome_template_countries = new Bloodhound({  datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),  queryTokenizer: Bloodhound.tokenizers.whitespace,  limit: 10,  local: $.map(_data_states_template_countries, function(state) { return { name: state }; })}); // kicks off the loading/processing of `local` and `prefetch`custome_template_countries.initialize();$('#custom-templates .typeahead').typeahead(null, {    displayKey: 'name',  source: custome_template_countries.ttAdapter(),  templates: {    empty: [      '<div class="empty-message">',      'unable to find a country',      '</div>'    ].join('\n'),    suggestion: Handlebars.compile('<p><strong>{{name}}</strong></p>')  }});</script><p>5.multiple data set</p><style>#multiple-datasets .league-name {  margin: 0 20px 5px 20px;  padding: 3px 0;  border-bottom: 1px solid #ccc;}</style><div id="multiple-datasets">  <input class="typeahead" type="text" placeholder="NBA and NHL teams"></div><script>var _data_nhlteam = [{ "team": "New Jersey Devils" },{ "team": "New York Islanders" },{ "team": "New York Rangers" },{ "team": "Philadelphia Flyers" },{ "team": "Pittsburgh Penguins" },{ "team": "Chicago Blackhawks" },{ "team": "Columbus Blue Jackets" },{ "team": "Detroit Red Wings" },{ "team": "Nashville Predators" },{ "team": "St. Louis Blues" },{ "team": "Boston Bruins" },{ "team": "Buffalo Sabres" },{ "team": "Montreal Canadiens" },{ "team": "Ottawa Senators" },{ "team": "Toronto Maple Leafs" },{ "team": "Calgary Flames" },{ "team": "Colorado Avalanche" },{ "team": "Edmonton Oilers" },{ "team": "Minnesota Wild" },{ "team": "Vancouver Canucks" },{ "team": "Carolina Hurricanes" },{ "team": "Florida Panthers" },{ "team": "Tampa Bay Lightning" },{ "team": "Washington Capitals" },{ "team": "Winnipeg Jets" },{ "team": "Anaheim Ducks" },{ "team": "Dallas Stars" },{ "team": "Los Angeles Kings" },{ "team": "Phoenix Coyotes" },{ "team": "San Jose Sharks" }];var _data_nbateam = [{ "team": "Boston Celtics" },{ "team": "Dallas Mavericks" },{ "team": "Brooklyn Nets" },{ "team": "Houston Rockets" },{ "team": "New York Knicks" },{ "team": "Memphis Grizzlies" },{ "team": "Philadelphia 76ers" },{ "team": "New Orleans Hornets" },{ "team": "Toronto Raptors" },{ "team": "San Antonio Spurs" },{ "team": "Chicago Bulls" },{ "team": "Denver Nuggets" },{ "team": "Cleveland Cavaliers" },{ "team": "Minnesota Timberwolves" },{ "team": "Detroit Pistons" },{ "team": "Portland Trail Blazers" },{ "team": "Indiana Pacers" },{ "team": "Oklahoma City Thunder" },{ "team": "Milwaukee Bucks" },{ "team": "Utah Jazz" },{ "team": "Atlanta Hawks" },{ "team": "Golden State Warriors" },{ "team": "Charlotte Bobcats" },{ "team": "Los Angeles Clippers" },{ "team": "Miami Heat" },{ "team": "Los Angeles Lakers" },{ "team": "Orlando Magic" },{ "team": "Phoenix Suns" },{ "team": "Washington Wizards" },{ "team": "Sacramento Kings" }];var nhlTeams = new Bloodhound({  datumTokenizer: Bloodhound.tokenizers.obj.whitespace('team'),  queryTokenizer: Bloodhound.tokenizers.whitespace,  local: _data_nhlteam}); var nbaTeams = new Bloodhound({  datumTokenizer: Bloodhound.tokenizers.obj.whitespace('team'),  queryTokenizer: Bloodhound.tokenizers.whitespace,  local: _data_nbateam}); nhlTeams.initialize();nbaTeams.initialize();$('#multiple-datasets .typeahead').typeahead({  highlight: true},{  displayKey: 'team',  source: nbaTeams.ttAdapter(),  templates: {  header: '<h3 class="league-name">NBA Teams</h3>'  }},{  displayKey: 'team',  source: nhlTeams.ttAdapter(),  templates: {   header: '<h3 class="league-name">NHL Teams</h3>'  }});</script><p>6. scrollable drop down</p><style>#scrollable-dropdown-menu .tt-dropdown-menu {  max-height: 100px;  width:600px;  overflow-y: auto;}</style><div id="scrollable-dropdown-menu">  <input class="typeahead" type="text" placeholder="Countries"></div><script>var _data_scrollable_dropdown_countries = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California',  'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii',  'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana',  'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',  'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire',  'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota',  'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island',  'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont',  'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'];var _data_scrollable_dropdown_countries = new Bloodhound({  datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),  queryTokenizer: Bloodhound.tokenizers.whitespace,  limit: 10,  local: $.map(_data_states_template_countries, function(state) { return { name: state }; })}); // kicks off the loading/processing of `local` and `prefetch`_data_scrollable_dropdown_countries.initialize();$('#scrollable-dropdown-menu .typeahead').typeahead(null, {  name: 'countries',  displayKey: 'name',  source: _data_scrollable_dropdown_countries.ttAdapter()});</script>


另外,這個DateRangePicker可以考慮用來選擇時間間隔,也是很不錯的:

https://github.com/dangrossman/bootstrap-daterangepicker



autocomplete="off" inpu屬性

input 的屬性autocomplete 預設為on

其含義代表是否讓瀏覽器自動記錄之前輸入的值

很多時候,需要對客戶的資料進行保密,防止瀏覽器軟體或者惡意外掛程式擷取到

可以在input中加入autocomplete="off" 來關閉記錄

系統需要保密的情況下可以使用此參數
 
AutoComplete:IEXPLOREEXE - 應用程式錯誤

您好!出現:0x???????? 指令引用的0x????????記憶體。該記憶體不能為"read"或"written"。答案【shijan8原創】★嚴禁複製★
【1】對電腦沒有影響或【偶爾】出現,不用管它,【重啟電腦】後可能會自動消失。
【2】盜版系統或Ghost版本系統,系統檔案錯誤或丟失,也會出現該問題,及時安裝官方發行的補丁,{檢查電腦年、月、日是否正確}。建議:安裝【正版】系統。
【3】檢查驅動是否出現問題,重新安裝驅動或及時更新驅動。
【4】病毒引起的:升級殺毒軟體或下載專殺工具,清理惡意外掛程式,對電腦全盤殺毒。
【5】硬體引起的:
(1)可能是記憶體條出現的小問題,關機斷電,把記憶體條拆下清理乾淨重新安裝。必要時更換記憶體條。(硬體上一般不會出現該問題)
【6】軟體引起的:
(1)安裝的軟體與系統或其它軟體發生衝突,盜版或帶病毒的軟體,請謹慎下載軟體,最好使用正版。【這裡主要說的是檢查開機啟動項,把沒必要啟動的啟動項禁止開機啟動】
(2)如果你的電腦中安裝了兩款或兩款以上的同類軟體,比如:兩款殺毒軟體、兩款最佳化系統軟體等,請卸載一款,以免發生衝突,以保持電腦穩定性。
(3)有些系統補丁下載安裝了錯誤補丁,可能與您當前的系統或其它軟體發生衝突,也會出現該問題。卸載該補丁,找到適合您電腦補丁,重新下載重新安裝。
【注意】:如果以確定電腦沒有病毒,檢查清理電腦是否存在惡意外掛程式,把它清理掉。如果您使用windows IE瀏覽器出現該問題,尤其是打了錯誤補丁,最近一段時間windows IE變得不太穩定。用360安全衛士、安裝的急救箱或其它軟體進行系統修複,如果沒有效果,升級或降低IE版本試試。如果還是不行,最簡單的解決辦法就是:下載更換其它瀏覽器。【不用刪除windows IE,直接使用其它瀏覽器即可。】比如:360安全瀏覽器、世界之窗瀏覽器、傲遊等。
可以試試下面的方法:看看能不能解決。
◆開始→運行→輸入cmd→斷行符號,在命令提示字元下輸入下面命令
for %1 in (%windir%\system32\*.dll) do regsvr32.exe /s %1斷行符號。
完成後,在輸入下面的
for %i in (%windir%\system32\*.ocx) do regsvr32.exe /s %i 斷行符號。
如果怕輸入錯誤,可以複製這兩條指令,然後在命令提示字元後擊滑鼠右鍵,打“粘貼”,斷行符號,耐心等待,直到螢幕滾動停止為止。(重啟電腦)。
●在檢查運行regedit進入註冊表, 在HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellExecuteHooks 下,應該只有一個正常的索引值{AEB6717E-7E19-11d0-97EE-00C04FD91972}, 將其他的刪除。【如果還有一個(預設)值不用管它,一般它為空白。】必要時【還原】或重新安裝系統。
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.