首页 > 其他 > 详细

6.2.15 彷淘宝搜索框

时间:2018-07-21 22:28:43      阅读:189      评论:0      收藏:0      [点我收藏+]

 

技术分享图片

 

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			*{padding: 0;margin: 0;}
			
			#search{
				position: relative;
			}
			
			input{
				outline: none;
				display: block;
				width: 490px;
				height: 50px;
				margin-top: 20px;
				font-size: 20px;
				border: 2px solid orange;
				border-radius: 10px;
				
								
			}
			label{
				position: absolute;
				top: 20px;
				left: 10px;
				font-size:8px;
				color: gray;

			}
		</style>
	</head>
	<body>
		<div id="search">
			<input type="text" id="text" />		
			<label for="txt" id="msg">路飞学城</label>
		</div>
	</body>
	
	<script type="text/javascript">
		var txt = document.getElementById(‘text‘);
		var msg = document.getElementById(‘msg‘);
		
		//检测用户表单输入的时候
		txt.oninput = function(){
			
			if (this.value == ‘‘) {
				msg.style.display = ‘block‘
			}else{
				msg.style.display = ‘none‘
			}
		}
		
	</script>
</html>

  

6.2.15 彷淘宝搜索框

原文:https://www.cnblogs.com/beallaliu/p/9348032.html

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