How to use other characters to show password javascript
By default whenver we start to type in password field its automatically changed into Asterisk
character or sign . but sometimes we need to show password characters into another pattern or format ...like (#####) or a number or a character.
So today we learn how to change a textbox field pattern and how to use other character or special symbol to show password.
So here is the javascript function and code that will change your input box pattern to show password.
In this example we show our password in hash format.
<html>
<head>
<title></title>
<script type="text/javascript">
var k=0;
var df;
window.onload=function() {
df=document.forms[0];
df[1].onkeyup=function() {
df[0].value+=df[1].value.charAt(k);
k++;
for(c=0;c<df[1].value.length;c++) {
df[1].value=df[1].value.replace(df[1].value.charAt(c),'#');
}
}
}
</script>
</head>
<body>
<noscript>
<div>
Without javascript enabled you will be unable to login
</div>
</noscript>
<form action="http://www.thecoderain.blogspot.com/">
<div>
<input type="hidden" name="password">
<input type="text">
<input type="submit" value="submit password">
</div>
</form>
</body>
</html>
<body>
<noscript>
<div>
Without javascript enabled you will be unable to login
</div>
</noscript>
<form action="http://www.thecoderain.blogspot.com/">
<div>
<input type="hidden" name="password">
<input type="text">
<input type="submit" value="submit password">
</div>
</form>
</body>
</html>
Comments
Post a Comment