<body>
<div class="box">
<input type="text" value="邮箱/ID/手机号" class="med">
</div>
<script>
var med = document.querySelector('.med');
med.onfocus = function() {
this.className = 'ipt';
this.value = '';
}
med.onblur = function() {
this.className = 'med';
this.value = '邮箱/ID/手机号';
}
</script>
</body>
<style>
* {
margin: 0;
padding: 0;
}
.box {
margin: 100px 200px;
color: pink;
}
.med {
color: gray;
border: 1px solid gray ;
}
.ipt {
color: gray;
border: 1px solid pink;
}
</style>
我是看的另外一个博主的代码,本来想用多类名来做但是不知道为什么边框的颜色不改变,然后和博主一样也不行
求各位大佬帮忙看看哪里出错了