网站地图    收藏   

主页 > 前端 > css教程 >

利用css来做页面文本筛选过滤 - html/css语言栏目:

来源:自学PHP网    时间:2015-04-14 14:51 作者: 阅读:

[导读] !-- ruby -run -e httpd . -p 4000 -- !DOCTYPE html head titleJS Workflow Tree/title link rel=stylesheet type=text/css href=./css/index.css/ scrip......

<!-- ruby -run -e httpd . -p 4000 -->  
<!DOCTYPE>  
<html>  
<head>  
<title>JS Workflow Tree</title>  
<link rel="stylesheet" type="text/css" href="./css/index.css"/>  
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>  
<script type="text/coffeescript" src="./js/index.js.coffee"></script>  
<script type="text/javascript" src="./js/coffee-script.js"></script>  
<meta charset="utf8">  
</head>  
<body>  
    <ul class="contacts">  
        <li class="searchable" data-index="onabednarschamberger.frank@wuckert.com1-265-479-1196x714">  
        <dl>  
              <dt>First Name</dt><dd>Ona</dd>  
                <dt>Last Name</dt><dd>Bednar</dd>  
                <dt>Email</dt><dd>schamberger.frank@wuckert.com</dd>  
                <dt>Phone</dt><dd>1-265-479-1196x714</dd>  
            </dl>  
        </li>  
  
        <li class="searchable" data-index="newtoncronintorphy.dorothea@gmail.com(121)644-5577">  
            <dl>  
                    <dt>First Name</dt><dd>Newton</dd>  
                    <dt>Last Name</dt><dd>Cronin</dd>  
                    <dt>Email</dt><dd>torphy.dorothea@gmail.com</dd>  
                    <dt>Phone</dt><dd>(121)644-5577</dd>  
            </dl>  
        </li>  
    </ul>  
  
<input type="text" placeholder="search" id="search">  
<style id="search_style"></style>  
<script type="text/javascript">  
    var searchStyle = document.getElementById('search_style');  
    document.getElementById('search').addEventListener('input', function() {  
          if (!this.value) {  
          searchStyle.innerHTML = "";  
            return;  
            }  
            searchStyle.innerHTML = ".searchable:not([data-index*=\"" + this.value.toLowerCase() + "\"]) { display: none; }";  
  
    });  
</script>  
</html>  

 

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论