zoukankan      html  css  js  c++  java
  • 仿淘宝搜索框

    <style type="text/css">
    #search{
    margin: 100px auto;
    300px;
    height: 40px;
    position: relative;
    }
    #search input{
    200px;
    height: 20px;
    }
    #search label{
    position: absolute;
    left: 20px;
    top: 5px;
    cursor: text;
    color: #ccc;
    }
    </style>
    <script type="text/javascript">
    window.onload = function(){
    var txt = document.getElementById("txt");
    var message = document.getElementById("message");
    txt.oninput = onpropertychange = function(){
    if(txt.value == ""){
    message.style.display = "block";
    }else{
    message.style.display = "none";
    }
    }
    }

    </script>

    <body>
    <div id="search">
    <input type="text" id="txt">
    <label for="txt" id="message">好睡眠好床品</label>
    </div>
    </body>

  • 相关阅读:
    吊打XXX
    [CQOI2011]动态逆序对
    陌上花开
    【BOI2007】摩基亚Mokia
    [SCOI2008]奖励关
    最小生成树
    打表
    【中学高级本】倒酒
    整数合并
    韩信点兵
  • 原文地址:https://www.cnblogs.com/zhaocong/p/6848113.html
Copyright © 2011-2022 走看看