1个回答
展开全部
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<input id='password' type="password" />
<script>
var password = document.querySelector('#password')
password.addEventListener('focus', function(e) {
this.setAttribute('type', 'text')
})
password.addEventListener('blur', function(e) {
this.setAttribute('type', 'password')
})
</script>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询