一个注册页面

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册页面</title>
    <style>
        body,input{
            margin: 0;
            padding: 0;
        }
        body{
            background-image: url(images/bg.jpg);/*设置背景图片*/
            background-repeat:no-repeat;/*图片适应窗口大小,这里设置的是不进行平铺*/
            background-attachment: fixed;/*图片相对于浏览器固定,这里设置背景图片固定,不随内容滚动*/
            background-origin: border-box;/*从边框区域显示*/
            background-size:cover;/
        }
        input{
            display: inline-block;
            background: #fff;
        }
        .container{
            width: 100%;
        }
        .register-box{
            position: relative;
            height: 800px;
            width: 800px;
            top: 50px;
            margin: 0 auto;
            z-index: 99999;
            background:#ffffff;
            border: 7px solid #ccc;
        }
        .title-box{
            position: absolute;
            width: 300px;
            height: 50px;
            margin-left: 250px;
            margin-top: 5px;
            text-align: center;
            font-size: 28px;
            font-weight: 800;
            color: black;
            line-height: 50px;
        }
        .username-box{
            position: absolute;
            width: 420px;
            height: 40px;
            line-height: 40px;
            margin-top:100px;
            margin-left:80px;
            font-weight: 700;
        }
        .username-input{
            display: inline-block;
            margin-left: 45px;
            /*background: green;*/
        }
        #username{
            height: 35px;
            width: 290px;
            border: 2px solid #ccc;
            border-radius: 5px;
        }
        .password-box{
            position: absolute;
            width: 420px;
            height: 40px;
            line-height: 40px;
            margin-top:180px;
            margin-left:80px;
            font-weight: 700;
        }
        .password-input{
            display: inline-block;
            margin-left: 61px;
        }
        #password{
            height: 35px;
            width: 290px;
            border: 2px solid #ccc;
            border-radius: 5px;
        }
        .rePassword-box{
            position: absolute;
            width: 420px;
            height: 40px;
            line-height: 40px;
            margin-top:260px;
            margin-left:80px;
            font-weight: 700;
        }
        .rePassword-input{
            display: inline-block;
            margin-left: 28px;
        }
        #rePassword{
            height: 35px;
            width: 290px;
            border: 2px solid #ccc;
            border-radius: 5px;
        }
        .phone-box{
            position: absolute;
            width: 420px;
            height: 40px;
            line-height: 40px;
            margin-top:340px;
            margin-left:80px;
            font-weight: 700;
        }
        .phone-input{
            display: inline-block;
            margin-left: 28px;
        }
        #phone{
            height: 35px;
            width: 290px;
            border: 2px solid #ccc;
            border-radius: 5px;
        }
        .email-box{
            position: absolute;
            width: 420px;
            height: 40px;
            line-height: 40px;
            margin-top:420px;
            margin-left:80px;
            font-weight: 700;
        }
        .email-input{
            display: inline-block;
            margin-left: 28px;
        }
        #email{
            height: 35px;
            width: 290px;
            border: 2px solid #ccc;
            border-radius: 5px;
        }

        .gender-box{
            position: absolute;
            width: 420px;
            height: 40px;
            line-height: 40px;
            margin-top:500px;
            margin-left:82px;
            font-weight: 700;
        }
        .gender-input{
            display: inline-block;
            margin-left: 62px;
        }
        .require{
            color: red;
        }
        .submit-box{
            position:absolute;
            width: 66px;
            height: 40px;
            line-height: 40px;
            margin-top: 580px;
            margin-left:200px;
            border-radius: 5px;
            background: grey;
        }
        #submit-button{
            display: inline-block;
            width: 66px;
            height: 40px;
            border-radius: 5px;
            background: green;
        }
        .goLogin-box{
            position:absolute;
            width: 150px;
            height: 20px;
            margin-top: 600px;
            margin-left:320px;

        }

    </style>
</head>
<body>
<div class="container">
    <div class="register-box">
        <div class="title-box">
            <span>用户注册页面</span>
        </div>
        <form action="#" method="post">
            <div class="username-box">
                <span class="require">*</span>
                <label for="username">用户名</label>
                <div class="username-input">
                    <input type="text" id="username" name="username" placeholder="请输入用户名 " />
                </div>
            </div>

            <div class="password-box">
                <span class="require">*</span>
                <label for="password">密码</label>
                <div class="password-input">
                    <input type="password" id="password" name="password" placeholder="请输入密码 " />
                </div>
            </div>

            <div class="rePassword-box">
                <span class="require">*</span>
                <label for="rePassword">确认密码</label>
                <div class="rePassword-input">
                    <input type="password" id="rePassword" name="RePassword" placeholder="请重复输入密码" />
                </div>
            </div>

            <div class="phone-box">
                <span class="require">*</span>
                <label for="phone">手机号码</label>
                <div class="phone-input">
                    <input type="text" id="phone" name="phone" placeholder="请输入手机号码" />
                </div>
            </div>

            <div class="email-box">
                <span class="require">*</span>
                <label for="email">电子邮箱</label>
                <div class="email-input">
                    <input type="text" id="email" name="email" placeholder="请输入邮箱地址" />
                </div>
            </div>

            <div class="gender-box">
                <span class="require">*</span>
                <label for="gender">性别</label>
                <div class="gender-input">
                    <input type="radio" id="gender" name="gender" value="男" checked="checked" />男   
                    <input type="radio" id="gender" name="gender" value="女" />女
                </div>
            </div>

            <div class="submit-box">
                <input id = "submit-button" type="submit" value="注册">
            </div>

            <div class="goLogin-box">
                <a href="#" style="text-decoration: none;">已有账号?去登录</a>
            </div>
        </form>
    </div>
</div>
</body>
</html>

效果如下图

在这里插入图片描述

要做一个注册页面,你可以使用HTML和CSS来创建界面,使用JavaScript来实现一些交互功能,使用后端语言(如PHP、Python等)来处理用户提交的数据并将其保存到数据库中。下面是一个简单的注册页面示例,包含输入用户名、密码、确认密码和电子邮件地址的表单: ```html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>注册页面</title> <style> /* 样式表 */ label, input { display: block; margin-bottom: 10px; } input[type="submit"] { margin-top: 20px; } </style> <script> // JavaScript代码 function validateForm() { var username = document.forms["myForm"]["username"].value; var password = document.forms["myForm"]["password"].value; var confirm_password = document.forms["myForm"]["confirm_password"].value; var email = document.forms["myForm"]["email"].value; if (username == "") { alert("用户名不能为空"); return false; } if (password == "") { alert("密码不能为空"); return false; } if (confirm_password == "") { alert("确认密码不能为空"); return false; } if (password != confirm_password) { alert("两次输入的密码不一致"); return false; } if (email == "") { alert("电子邮件地址不能为空"); return false; } } </script> </head> <body> <h2>注册页面</h2> <form name="myForm" action="register.php" onsubmit="return validateForm()" method="post"> <label>用户名:</label> <input type="text" name="username"> <label>密码:</label> <input type="password" name="password"> <label>确认密码:</label> <input type="password" name="confirm_password"> <label>电子邮件地址:</label> <input type="email" name="email"> <input type="submit" value="注册"> </form> </body> </html> ``` 在这个示例中,我们使用了HTML和CSS来创建了一个简单的注册页面,其中包含输入用户名、密码、确认密码和电子邮件地址的表单。我们使用了JavaScript来实现了一个简单的表单验证函数,该函数会在表单提交之前检查用户输入的数据是否合法,如果不合法则会弹出一个警告框提示用户。在表单的action属性中,我们指定了一个后端脚本文件(register.php),该文件会处理用户提交的数据并将其保存到数据库中。 当用户提交表单时,浏览器会将表单数据发送到后端脚本文件(register.php)进行处理。在这个脚本文件中,你可以使用数据库操作语句来将用户提交的数据保存到数据库中。具体的实现方式因不同的后端语言而异,例如,在PHP中,你可以使用mysqli或PDO等扩展来连接和操作数据库。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值