首页 > 其他 > 详细

仿淘宝搜索框

时间:2017-05-13 11:01:33      阅读:268      评论:0      收藏:0      [点我收藏+]

<style type="text/css">
#search{
margin: 100px auto;
width: 300px;
height: 40px;
position: relative;
}
#search input{
width: 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>

仿淘宝搜索框

原文:http://www.cnblogs.com/zhaocong/p/6848113.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!