当前位置: 首页 > article >正文

HTML密码小眼睛

<!DOCTYPE html>
<html lang="zh_cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>密码小眼睛</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f8f8f8;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }
        .login-container {
            width: 400px;
			height: 300px;
            padding: 40px;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        }
        .login-container h2 {
		    text-align: center;
            margin-bottom: 20px;
        }
        .form-group {
		    text-align: center;
            margin-bottom: 15px;
        }
        .form-group label {
            display: block;
            margin-bottom: 5px;
        }
        .form-group input[type="text"],
        .form-group input[type="password"] {
            width: 80%;
            padding: 6px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box; /* Makes sure the padding does not affect the total width of the input */
        }
        .form-group input[type="submit"] {   
            width: 80%;
            padding: 8px;
            border: none;
            border-radius: 4px;
            background-color: #5cb85c;
            color: white;
            cursor: pointer;
        }
        .form-group input[type="submit"]:hover {
            background-color: #4cae4c;
        }
    </style>
</head>
<body>
    <div class="login-container" >
        <form action="/" method="GET">
            <div class="form-group">
                <input type="text" id="username" name="username" required placeholder="用户名">
            </div>
            <div class="form-group">
				 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				 <input type="password" id="password" name="password" required placeholder="密码">
				 <span onclick="togglePassword()" id="eyeIcon" class="fa fa-eye"></span>	 
            </div>
            <div class="form-group">
                <input type="submit" value="登录">
            </div>
        </form>
    </div>
</body>
</html>

<script>
function togglePassword() {
  var passwordField = document.getElementById("password");
  var eyeIcon = document.getElementById("eyeIcon");
  if (passwordField.type === "password") {
    passwordField.type = "text";
    eyeIcon.className = "fa fa-eye-slash";
  } else {
    passwordField.type = "password";
    eyeIcon.className = "fa fa-eye";
  }
}
</script>
<!-- 引入Font Awesome图标库 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">


http://www.kler.cn/a/409773.html

相关文章:

  • go-web项目通用脚手架
  • SAP_MM/CO模块-超详细的CK11N/CK40N取值逻辑梳理(十几种业务场景,1.76W字)
  • AIX下crs-5005 ip address is aready in use in the network的解决办法
  • 详细探索xinput1_3.dll:功能、问题与xinput1_3.dll丢失的解决方案
  • C#构建一个简单的前馈神经网络
  • Java---反射机制
  • 区块链学习笔记(1)--区块、链和共识 区块链技术入门
  • 【分治】--- 快速选择算法
  • 【优选算法】前缀和
  • C++入门学习基础
  • C++ 编程指南06 - 不要泄漏任何资源
  • 蓝桥杯每日真题 - 第23天
  • 【C++】C++11新特性详解:可变参数模板与emplace系列的应用
  • World of Warcraft /script SetRaidTarget(“target“, n, ““) n=8,7,6,5,4,3,2,1,0
  • 深入探讨异步 API 的设计与实现
  • [C++]了解内置类型升级
  • Qt 开发笔记
  • 提供html2canvas+jsPDF将HTML页面以A4纸方式导出为PDF后,内容分页时存在截断的解决思路
  • 人工智能学习框架:理论与实践的结合
  • JavaScript网页设计案例:动态交互与用户体验提升
  • 音频档案批量拷贝:专业SD拷贝机解决方案
  • C 语言复习总结记录六
  • Top 10 Tools to Level Up Your Prompt Engineering Skills
  • TCP快速重传机制为啥出现重复ACK?
  • 安全加固方案
  • opencv读写文件操作