Home > Web Front-end > JS Tutorial > body text

JavaScript hides and displays passwords_javascript skills

WBOY
Release: 2016-05-16 16:00:13
Original
1286 people have browsed it

The method of viewing the plain text information in the hidden password box implemented by javascript. Asterisks are displayed when the user enters the password. How to view the plain text information? You can use js to view the plain text of the password box.

Enter the password in the password box, it will be displayed with asterisks, and the text content will be automatically hidden.

Asterisks are displayed when the user enters the password. How to view the plain text information? You can use js to view the plain text of the password box.

Code:

<html><head><title>密码的隐藏与显示</title>
</head>
<body bgcolor=#fef4d9><br><br>
<center>密码的隐藏与显示</center><br>
<center>
<table bordercolor=#cc0000 border=5 borderlight="green">
<tbody>
<tr>
<td align=middle><div align="center">效果显示</div></td>
</tr>
<tr>
<td align=middle>
<form name=forms action="" method=post><span id=box>
<input type=password value=523654 name=password></span> <span id=click><a href="javascript:ps()">显示密码</a></span>
<script language=javascript>
function ps(){
if (this.forms.password.type="password")
box.innerhtml="<input type="html" name="password" size="20" value="+this.forms.password.value+">";
click.innerhtml="<a href="javascript:txt()">隐藏密码</a>"}
function txt(){
if (this.forms.password.type="text")
box.innerhtml="<input type="password" name="password" size="20" value="+this.forms.password.value+">";
click.innerhtml="<a href="javascript:ps()">显示密码</a>"}
</script>
</form></td></tr></tbody></table></center>
</body>
</html>
Copy after login

The above is the entire content of this article, friends in need can refer to it.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template