如何通过取消选中复选框将密码字段切换为文本和密码?
最佳答案
这是您要找的东西吗??
<html>
<head>
<script>
function changeType()
{
document.myform.txt.type=(document.myform.option.value=(document.myform.option.value==1)?'-1':'1')=='1'?'text':'password';
}
</script>
</head>
<body>
<form name="myform">
<input type="text" name="txt" />
<input type="checkbox" name="option" value='1' onchange="changeType()" />
</form>
</body>
</html>
关于javascript - 使用 jQuery 将密码字段更改为带有复选框的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1970793/