【问题标题】:HTML password is not same lengthHTML密码长度不同
【发布时间】:2017-10-29 18:15:51
【问题描述】:

我正在做这个 HTML 页面,不知道为什么这两个密码区域大小不一样。我已经从第一个复制粘贴,所以它 100% 相同。 我刚开始为一个学期项目制作神话的第一个 HTML 页面,需要帮助。

当我看到它的样子时,它看起来像这样:

</script>  
<div show/hide password>
<script>
function pass(){
    var d=document.getElementById('s1');
    var e=document.getElementById('show_f').value;
    var f=document.getElementById('show_f').type; 

    if(d.value=="show"){
        var f= document.getElementById('show_f').type="text";
        var g=document.getElementById('show_f').value=e;
        d.value="Hide";

    } else{
        var f= document.getElementById('show_f').type="password";
        var g=document.getElementById('show_f').value=e;
        d.value="show";
     }     
  }   
  </script> 
  <script>
function pass2(){
    var d=document.getElementById('s2');
    var e=document.getElementById('show_g').value;
    var f=document.getElementById('show_g').type; 

    if(d.value=="show"){
        var f= document.getElementById('show_g').type="text";
        var g=document.getElementById('show_g').value=e;
        d.value="Hide";

    } else{
        var f= document.getElementById('show_g').type="password";
        var g=document.getElementById('show_g').value=e;
        d.value="show";
     }     
  }   
  </script> 
  </div>
.password {
  margin-left: 50px;
}
 <table>
    <tr>
<th>  <form action="/action_page.php" >
  <!-- password for Wi-Fi login -->
      <p class="text" class="arial"  style="font-size:20px;">Password: <input style="font-size:20px"  id="show_f" type="password" name="pass_f" maxlength='30'  size='15' class="password" >
  <input type="button" onclick="pass()" id="s1" value="show" style="height:25px; margin-left:5px;margin-top:3px;">
<input type="submit" value="connect" onclick="alert('Done!')" ></th>
<!-- password for sql login -->
  <th><p class="text" class="arial"  style="font-size:20px;">Password: <input style="font-size:20px" id="show_g"  type="password" name="pass_g" maxlength='30'  size='15' class="password" >
    <input type="button" onclick="pass2()" id="s2" value="show" style="height:25px; margin-left:5px;margin-top:3px;">
  	     <input type="submit" value="connect" onclick="alert('Done!')" ></th>

  </table>
</form>

【问题讨论】:

  • 移除margin-left: 50px;并设置body{margin:0}
  • 一点帮助都没有

标签: javascript html css


【解决方案1】:

请仔细看,widthheight都一样,over。不是吗?

function pass(){
    var d=document.getElementById('s1');
    var e=document.getElementById('show_f').value;
    var f=document.getElementById('show_f').type; 

    if(d.value=="show"){
        var f= document.getElementById('show_f').type="text";
        var g=document.getElementById('show_f').value=e;
        d.value="Hide";

    } else{
        var f= document.getElementById('show_f').type="password";
        var g=document.getElementById('show_f').value=e;
        d.value="show";
     }     
  }   
  </script> 
  <script>
function pass2(){
    var d=document.getElementById('s2');
    var e=document.getElementById('show_g').value;
    var f=document.getElementById('show_g').type; 

    if(d.value=="show"){
        var f= document.getElementById('show_g').type="text";
        var g=document.getElementById('show_g').value=e;
        d.value="Hide";

    } else{
        var f= document.getElementById('show_g').type="password";
        var g=document.getElementById('show_g').value=e;
        d.value="show";
     }     
  }   
body {
    margin: 0;
}

th {
    background: red;
}
<table>
    <tr>
<th>  <form action="/action_page.php" >
  <!-- password for Wi-Fi login -->
      <p class="text" class="arial"  style="font-size:20px;">Password: <input style="font-size:20px"  id="show_f" type="password" name="pass_f" maxlength='30'  size='15' class="password" >
  <input type="button" onclick="pass()" id="s1" value="show" style="height:25px; margin-left:5px;margin-top:3px;">
<input type="submit" value="connect" onclick="alert('Done!')" ></th>
<!-- password for sql login -->
  <th><p class="text" class="arial"  style="font-size:20px;">Password: <input style="font-size:20px" id="show_g"  type="password" name="pass_g" maxlength='30'  size='15' class="password" >
    <input type="button" onclick="pass2()" id="s2" value="show" style="height:25px; margin-left:5px;margin-top:3px;">
  	     <input type="submit" value="connect" onclick="alert('Done!')" ></th>

  </table>
</form>

【讨论】:

  • margin?是的,不需要设置margin 两者已经相同。 @RafySalamMarbin
猜你喜欢
  • 2019-07-02
  • 2011-02-21
  • 2016-04-15
  • 2014-04-01
  • 1970-01-01
  • 1970-01-01
  • 2014-09-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多