世纪佳缘
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>世纪佳缘</title>
<style>
input {
width: 200px;
height: 25px;
margin: 100px 300px;
border: 1px solid #d9d9d9;
color: #ccc;
outline: none;
}
.change {
border: 1px solid #ff9393;
color: #000;
}
.noChange {
border: 1px solid #d9d9d9;
color: #ccc;
}
</style>
</head>
<body>
<input type="text" value="邮箱/ID/手机">
<script>
var inp = document.querySelector('input');
inp.onfocus = function() {
if (inp.value == '邮箱/ID/手机') {
inp.value = '';
}
this.className = 'change';
}
inp.onblur = function() {
if (inp.value == '') {
inp.value = '邮箱/ID/手机';
}
this.className = 'noChange';
}
</script>
</body>