简体   繁体   English

覆盖type = password输入格式

[英]override type=password for input format

this is my login widget. 这是我的登录小部件。 as you can see the username and password fields have different textboxes. 如您所见,用户名和密码字段具有不同的文本框。 i want them to only have the textbox which the "username" field has. 我希望他们仅具有“用户名”字段具有的文本框。 problem is that the only thing that differs them is the input type. 问题在于,唯一不同的是输入类型。 and i want the password field to not show the password. 我希望密码字段不显示密码。 which the username field will. 用户名字段将是哪个。

so how do i solve this? 那么我该如何解决呢?

the code is this: 代码是这样的:

<div id="sidebar">
<div class="widget">
    <h3 class="widgettitle">Honestreviews.se</h3>
    <div class="textwidget">
        <form action="../login-exec.php" method="post">
        <ul id="login">
            <li>
                Username:<br>
                <input name="login" type="text" id="login" />
            </li>
            <li>
                Password:<br>
                <input name="password" type="password" id="password" />
            </li>
            <li>
                <input type="submit" value="Log in">
            </li>
            <li>
                <a href="register.php">Register</a>
            </li>
    </div>
</div>
<div class="widget_divide"></div>

http://i.imgur.com/8iUh7K8.png

The problem is your CSS. 问题是您的CSS。 Most likely you're only targeting input elements whose type is "text" (although you may also be only targeting a name or id equal to "login"): 您很可能只针对type为“文本”的input元素(尽管您也可能仅针对nameid等于“登录”的id ):

input[type="text"] {
    ...
}

You can rectify this by including input elements with a type of "password": 您可以通过包含type为“密码”的input元素来纠正此问题:

input[type="text"],
input[type="password"] {
    ...
}

Update: Based on the code you've provided your selector will need to be changed at line 1166. You'll also need to change your :focus selector at line 1189: 更新:根据您提供代码,需要在第1166行更改选择器。还需要在第1189行更改:focus选择器:

input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
    ...
}

As a side note, semantically your code appears to be invalid. 附带说明一下,从语义上讲,您的代码似乎无效。 Your form elements are wrapped in li elements. 您的表单元素包含在li元素中。 What exactly is this a list of? 这到底是什么清单?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM