簡體   English   中英

HTML中的密碼字段隱藏選項

[英]Password field hidden option in html

對於我的HTML密碼文本框,我使用輸入類型作為密碼,但是我能夠看到正在鍵入什么作為密碼輸入。 無論如何,我們都不應該看到我們在密碼輸入中輸入的內容。

誰能建議我如何解決此問題? 請嘗試以下代碼,將其復制為.TXT文件並另存為.HTML,然后在Firefox或IE中打開此HTML以復制該問題。

這是我有問題的代碼:

<htm l>
    <form id="login" method="post" action="index.html">
    <div style="width: 450px; height: 250px; background: blue;BORDER=8"><br/><br/><br/>
    &nbsp;<strong>Username: </strong>&nbsp; <input type="text" name="userid" size="18" maxlength="18"/><br/>&nbsp;<br/>
    &nbsp;<strong>Password : </strong> &nbsp; <input type="password " name="pswrd" size="18" maxlength="18"/>&nbsp;<br/><br/><br/>&nbsp;&nbsp;

    <input type="submit" value="Submit"> &nbsp;&nbsp;
    <input type="reset" value="Cancel" onclick="myFunction()" value="Reset form"/> &nbsp;&nbsp;&nbsp 
    &nbsp;</div><br/><br/></html>

好的,您在type="password"有多余的空格

<input type="password" name="pswrd" size="18" maxlength="18"/>

去掉它。 它將正常工作。

在類型參數后刪除密碼后面的空格。

刪除type =“ password”中的空格,因此應該為type =“ password”

如果html無法識別“ password”之類的任何類型,則假定該元素為文本類型

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM