/*
输入框模糊匹配功能
*/
var inputBtn = document.getElementById("inputv");
var li = document.getElementsByTagName('li');
inputBtn.onkeyup = search;
function search(){
var inputCont = inputBtn.value; //string
for(var i = 0; i < li.length; i++){
var liCont = li[i].innerHTML; //string
console.log(typeof inputCont)
var macthStr = liCont.match(inputCont);
console.log(macthStr)
if(inputCont != 0){ //为什么加这个判断呢?不加的话,按Tab键(但是用鼠标点击则不会显示),输入框就算没有输入内容,隐藏的li标签也会显示
if(macthStr){
li[i].style.display = "block";
}else{
li[i].style.display = "none";
}
}
}
}