密码输入延迟屏蔽

这是一个类似iPhone、android等手机的密码输入体验,在用户输入密码时,可以将用户的输入以明文的方式短时间延迟屏蔽,主要用到了一个jQuery的插件:dpassword

 

<form action="#">
    <label for="password">Password:</label>
    <input type="password" name="password" id="password" value="" />
    <input type="submit" name="submit" value="show password" id="submit" onclick="alert('fieldname: ' + $('#password').attr('name') + '\npassword value: '+ $('#password').val()); return false;"/>
</form>
<p>and another password field:</p>
<form action="#">
    <label for="password2">Password:</label>
    <input type="password" name="password2" id="password2" value="" />
    <input type="submit" name="submit2" value="show password" id="submit2" onclick="alert('fieldname: ' + $('#password2').attr('name') + '\npassword value: '+ $('#password2').val()); return false;"/>
</form>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="lib/jQuery.dPassword.js"></script>
<script type="text/javascript">
    $(document).ready( function() {
        $('input:password').dPassword();
    });
</script>

 

你可能感兴趣的:(Web)