实现表单注册登录网页及其信息显示和跳转(javaweb实验)

下面是完整结果截图及其效果:

显示完整网页布局

点击按钮Register实现表单注册页的显示

点击按钮Login实现上个页面的跳转及登录页面的显示

点击个人简介按钮实现上个页面的跳转及个人简介页面的显示

参考代码如下:

<html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<head>
    <title>登录注册页</title>
    <style>
        #all{
            width: 1100px;
            height: 800px;
            background-color: #6CACD8;
            margin: auto;
        }
        #top{
            width: 1100px;
            height: 100px;
            background-color: aquamarine;
            margin: auto;
            position: absolute;
        }
        #center{
            width: 900px;
            height: 600px;
            background-color: lightgoldenrodyellow;
            position: absolute;
            margin-top: 200px;
            margin-left: 200px;
        }
        #right{
            width: 200px;
            height: 600px;
            background-color: aqua;
            position: absolute;
            margin-top: 200px;
        }
        #center table{
            width: 100%;
            height: 500px;

        }
        #register-form{
            display: none; /* 初始状态下隐藏 */
        }
        #login-form{
            display: none; /* 初始状态下隐藏 */
        }
        #information{
            display: none; /* 初始状态下隐藏 */
            margin: auto;
        }
        .cell1{
            text-align: right;
            padding-right: 20px;
        }
        .cell2{
            width: 220px;
            height: 25px;
            border: 1px solid grey;
            border-radius: 6px;
            padding-left: 6px;
        }
        .cell3{
            width: 200px;
            height: 40px;
            background-color: #6CACD8;
            border: 1px solid #6CACD8;
            border-radius: 20px;
        }
        .cell4{
            width: 120px;
            height: 25px;
            border: 1px solid grey;
            border-radius: 6px;
            padding-left: 6px;
        }
        .cell5{
            width: 180px;
            height: 25px;
            border: 1px solid grey;
            border-radius: 6px;
            padding-left: 6px;
        }
        .cell7{
            width: 500px;
            height: 25px;
            border: 1px solid grey;
            border-radius: 6px;
            padding-left: 6px;
        }
    </style>
    <title>Title</title>
</head>




<script>
    // 定义一个函数,用于显示注册表单
    function showRegisterForm() {
        // 获取注册表单,并将其显示出来

        document.getElementById("register-form").style.display="block";
        document.getElementById("login-form").style.display="none";
        document.getElementById("information").style.display="none";
    }

    // 定义一个函数,用于显示注册表单
    function showLoginForm() {
        // 获取注册表单,并将其显示出来

        document.getElementById("login-form").style.display="block";
        document.getElementById("register-form").style.display="none";
        document.getElementById("information").style.display="none";

    }

    function showInformation(){
        document.getElementById("information").style.display="block";
        document.getElementById("register-form").style.display="none";
        document.getElementById("login-form").style.display="none";

    }

</script>


<body>
    <div id="all">

        <div id="top">
            <button onclick="showRegisterForm()" style="position:absolute;width: 100px;margin-top: 40px;margin-left: 530px">Register</button>
        </div>

        <button onclick="showLoginForm()" style="position:absolute;width: 100px;margin-top:140px;margin-left: 530px">Login</button>

        <div id="right">
        <button onclick="showInformation()" style="position:absolute;width:100px;display: block;margin-left: 45px;margin-top: 300px">个人简介</button>
        </div>

        <div id="center">
    <%--表一--%>
            <form id="information" style="display: none;">
                <table >
                    <br>
                    <br>
                    <caption style="text-align: center"><strong>Information</strong></caption>
                    <br>
                    <tr>
                        <td class="cell1">ID:</td>
                        <td>
                            K2
                        </td>

                    </tr>
                    <tr>
                        <td class="cell1">Password:</td>
                        <td>
                            ***************
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">First Name:</td>
                        <td>
                            ×
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">Last Name:</td>
                        <td>
                            ××
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">Address:</td>
                        <td>
                            ******
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">Country:</td>
                        <td>
                            中国
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">City:</td>
                        <td>
                            广州市
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">Email Address:</td>
                        <td>
                            **************
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">Interest:</td>
                        <td>
                            Technology;
                            Enterprise;
                            Research;
                            Government;
                            People;
                            Life Style;
                            Opinion
                        </td>
                    </tr>
                </table>
            </form>

<%--            表二--%>
            <form id="login-form" style="display: none;">
                <table>
                    <br>
                    <br>
                    <caption style="text-align: center"><strong>Please Log In</strong></caption>
                    <tr>
                        <td class="cell1">Login:</td>
                        <td>
                            <input class="cell7" type="text" placeholder="请输入Login">
                        </td>

                    </tr>
                    <tr>
                        <td class="cell1">Password:</td>
                        <td>
                            <input class="cell7" type="password" placeholder="请输入password">
                        </td>
                    </tr>
                    <tr>
                        <td> </td>
                        <td>
                            <input class="cell3" type="button" value="OK" style="padding-left: 6px">
                            <input class="cell3" type="button" value="Forget Password" >
                        </td>
                    </tr>
                </table>
            </form>

<%--            表三--%>
            <form id="register-form" style="display: none;">
                <table >
                    <br>
                    <caption style="text-align: center"><strong>New Member</strong></caption>
                    <br>
                    <tr>
                        <td class="cell1">ID</td>
                        <td>
                            <input class="cell2" type="text" placeholder="请输入ID">
                        </td>

                    </tr>
                    <tr>
                        <td class="cell1">Password</td>
                        <td>
                            <input class="cell2" type="password" placeholder="请输入password">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">Re-Password</td>
                        <td>
                            <input class="cell2" type="password" placeholder="请再次输入password">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">First Name</td>
                        <td>
                            <input class="cell2" type="text" placeholder="请输入First Name">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">Last Name</td>
                        <td>
                            <input class="cell2" type="text" placeholder="请输入Last Name">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">Address</td>
                        <td>
                            <input class="cell2" type="text" placeholder="请输入Address">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">City</td>
                        <td>
                            <input class="cell2" type="text" placeholder="请输入所在City">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">State</td>
                        <td>
                            <select class="cell4" type="text" placeholder="请输入State">
                                <option>[Select State]</option>
                                <option>111</option>
                                <option>222</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">County</td>
                        <td>
                            <input class="cell2" type="text" placeholder="请输入County">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">Email Address</td>
                        <td>
                            <input class="cell2" type="email" placeholder="请输入Email Address">
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">Select Interest</td>
                        <td>
                            <input type="radio"/>Technology
                            <input type="radio"/>Enterprise
                            <input type="radio"/>Research
                            <input type="radio"/>Government
                            <input type="radio"/>People
                            <input type="radio"/>Life Style
                            <input type="radio"/>Opinion
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">Question</td>
                        <td>
                            <select class="cell5" type="text" placeholder="请输入Question">
                                <option>[Select Question]</option>
                                <option>你喜欢什么?</option>
                                <option>你喜欢我吗?</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="cell1">Answer</td>
                        <td>
                            <input class="cell2" type="text" placeholder="请输入Answer">
                        </td>
                    </tr>
                    <tr>
                        <td> </td>
                        <td>
                            <input class="cell3" type="button" value="Submit Information" >
                            <input class="cell3" type="button" value="Reset Form" >
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</body>
</html>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

تچ快乐杂货店يچ

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值