今天看啥
热点:

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}, 将其他的删除。【如果还有一个(默认)值不用管它,一般它为空。】必要时【还原】或重新安装系统。
 

www.bkjia.comtruehttp://www.bkjia.com/webzh/874872.htmlTechArticleAuto Complete,autocomplete 一个很好用的AutoComplete js: https://twitter.github.io/typeahead.js/ 这里是自己测试的一些demo: script src=jquery-1.11.1.min.js/scri...

相关文章

相关搜索: 应用程序错误

帮客评论

视觉看点