input中给他赋值值隐藏但框在
您可以使用HTML的input标签,并设置type为"password"来隐藏输入的值,同时设置CSS样式来显示输入框。
以下是一个示例代码:
<input type="password" id="password" style="border: 1px solid #000;">
<button onclick="showPassword()">显示密码</button>
<script>
function showPassword() {
var passwordInput = document.getElementById("password");
passwordInput.type = "text";
}
</script>
在上面的代码中,通过设置input的type为"password",输入的内容将被隐藏为圆点或星号。然后,通过设置input的样式border属性,可以显示输入框的边框。
通过点击按钮,可以调用showPassword函数,该函数将input的type属性更改为"text",从而显示输入的值。
请注意,这只是一种简单的方法来显示隐藏的密码,实际上这种做法存在一定的安全风险,因为密码被暴露在页面上。在实际开发中,应该根据具体需求和安全性考虑,选择合适的方法来处理密码输入。
原文地址: https://www.cveoy.top/t/topic/jceC 著作权归作者所有。请勿转载和采集!