<html>
<head>
  <meta charset="utf-8">
  <title>密码明文</title>
  <script language="JavaScript">
  function demo(){
    var tp=document.all["passwd"];
    //tp.setAttribute("type","text");     //ok1
    //tp.type="text";           //ok2
    var rd=document.all["rd"];
    if(rd.checked){
        tp.type="text";
    }else{
        tp.type="password";
    }
  }
  </script>
</head>

<body>
<form>

<fieldset style="width:300px;margin-left:35%;margin-top:10%;">
    <legend >设置为可选明文密码</legend>
        <table>
            <tr>
                <td><label for="rd" onfocus="demo()">是否为明文</label></td>
                <td><input type="checkbox" id="rd" name="rd" onclick="demo()"/></td>
            </tr>
            <tr>
                <td>用户名:</td>
                <td><input type="text" id="username"/></td>
            </tr>
            <tr>
                <td>&nbsp;码:</td>
                <td><input type="password" id="passwd" name="passwd"/></td>
            </tr>
        </table>        
</fieldset>

</form>
</body>
</html>
源码

相关文章:

  • 2022-12-23
  • 2022-03-05
  • 2022-12-23
  • 2021-08-18
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-05
  • 2021-06-20
  • 2021-07-19
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
相关资源
相似解决方案