登录注册页面连接数据库并完成注册(一)

这篇具有很好参考价值的文章主要介绍了登录注册页面连接数据库并完成注册(一)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1:我们先从html开始,注释不多,希望谅解,下面是html页面的代码:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="jq/jquery-3.3.1.js"></script>
    <link href="css/login.css" rel="stylesheet">
    <script type="text/javascript" src="js/login.js"></script>
</head>
<body>
    <div id="pop" style="display: none">
        <div id="pop_ts">提示</div>
        <div id="pop_tz">注册成功!</div>
        <div id="span" style="color: white" onclick="confirm()">确定</div>
    </div>
    <div id="header_top">
        <div id="login">
            <form id="form_1" class="box">
                <span class="logo_logo"><a href="header.jsp" class="a_logo">LOGO</a></span>
                <h1>登录</h1>
                <div id="login_ww" style="color: yellow"></div>
                <input class="dc" id="username1" type="text" name="username" placeholder="用户名">
                <input class="dc" id="password1" type="password" name="password" placeholder="密码">
                <input type="submit" name="no" value="登录" id="no">
                <p class="meassage">还未注册?<a id="onclick_1" onclick="fun('no')"> 注册</a></p>
                <div class="checkbox">
                    <label>
                        <input type="checkbox" name="yes" value="no" ><span class="checkboxmessage" style="font-size: 12px;">自动登录</span>
                    </label>
                </div>
            </form>
        </div>
        <div id="register">
            <form id="form" name="form" class="box">
                <span class="logo_logo"><a href="header.jsp" class="a_logo">LOGO</a></span>
                <h1>注册页面</h1>
                <div id="errorMsg" style="color: yellow"></div>
                <input class="a" id="username_1" type="text" name="username" placeholder="用户名英文" >
                <input class="a" id="password_1" type="password" name="password" placeholder="密码:数字加英文">
                <input class="a" id="phone_1" type="phone" name="phone" placeholder="中国移动电话号码11位">
                <input class="a" id="address_1" type="idcard" name="address" placeholder="地址如:四川省成都市武侯区">
                <input class="a" id="rgdate_1" type="rgdate" name="rgdate" placeholder="时间" style="display: none">
                <input type="submit" name="ok" id="ww" value="注册">
                <p class="meassage">已有账号?<a id="onclick_2" onclick="fun('yes')">登录</a></p>
            </form>
        </div>
    </div>
</body>
</html>

2:下面是一个css代码,可能比较乱:

body{
    margin: 0;
    padding: 0;
    font-family: sans-serif;
    background-image: url("../images/bg_01.png");
    background-size: cover;
}
a{
    cursor: pointer;
}
.box{
    width: 300px;
    padding: 40px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    background: #191919;
    opacity: 0.5;
    text-align: center;
}
.box h1{
    color: white;
    text-transform: uppercase;
    font-weight: 500;
}
.box input[type = "text"],.box input[type = "password"]{
    border:0;
    background: none;
    display: block;
    margin: 20px auto;
    text-align: center;
    border: 2px solid #3498db;
    padding: 14px 10px;
    width: 200px;
    outline: none;
    color: white;
    border-radius: 24px;
    transition: 0.25s;
}
.box input[type = "text"]:focus,.box input[type = "password"]:focus{
    width: 280px;
    border-color: #2ecc71;
}
.box input[type = "text"],.box input[type = "rgdate"]{
    border:0;
    background: none;
    display: block;
    margin: 20px auto;
    text-align: center;
    border: 2px solid #3498db;
    padding: 14px 10px;
    width: 200px;
    outline: none;
    color: white;
    border-radius: 24px;
    transition: 0.25s;
}
.box input[type = "text"]:focus,.box input[type = "rgdate"]:focus{
    width: 280px;
    border-color: #2ecc71;
}
.box input[type = "submit"]{
    border:0;
    background: none;
    display: block;
    margin: 20px auto;
    text-align: center;
    border: 2px solid #2ecc71;
    padding: 14px 40px;
    outline: none;
    color: white;
    border-radius: 24px;
    transition: 0.25s;
    cursor: pointer;
}
.box input[type = "submit"]:hover{
    background: #2ecc71;
}
.box .meassage{
    text-transform: uppercase;
    color:white;
}
.box .meassage a{
    color: aqua;
    text-decoration: none;
}
.checkboxmessage{
    color:white;
    font-size:18px;
}
.box input[type = "text"]:focus,.box input[type = "idcard"]:focus{
    width: 280px;
    border-color: #2ecc71;
}
.box input[type = "text"],.box input[type = "idcard"]{
    border:0;
    background: none;
    display: block;
    margin: 20px auto;
    text-align: center;
    border: 2px solid #3498db;
    padding: 14px 10px;
    width: 200px;
    outline: none;
    color: white;
    border-radius: 24px;
    transition: 0.25s;
}.box input[type = "text"]:focus,.box input[type = "phone"]:focus{
     width: 280px;
     border-color: #2ecc71;
 }
.box input[type = "text"],.box input[type = "phone"]{
    border:0;
    background: none;
    display: block;
    margin: 20px auto;
    text-align: center;
    border: 2px solid #3498db;
    padding: 14px 10px;
    width: 200px;
    outline: none;
    color: white;
    border-radius: 24px;
    transition: 0.25s;
}
.a_logo{
    cursor: pointer;
    color: rgb(189, 159, 170) ;
}
#register{
    display: none;
}
.logo_logo {
    width: 70px;
    height: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    float: left;
    text-align: center;
    display: inline;
    font-size: 20px;
    color: rgb(189, 159, 170) ;
    font-family: "Lucida Calligraphy";
}
#pop {
    width: 400px;
    height: 250px;
    top: 20%;
    left: 37%;
    position: absolute;
    background-color: white;
    z-index: 10;
}
#pop_ts{
    width: 400px;
    height: 100px;
    background-color: #191919;
    color: white;
    font-size: 35px;
    text-align: center;
    line-height: 100px;
}
#pop_tz{
    width: 400px;
    height: 50px;
    text-align: center;
    line-height: 50px;
    margin-top: 40px;
}
#span {
    width: 100px;
    height: 40px;
    background-color: #3498db;
    text-align: center;
    line-height: 40px;
    margin: 20px auto;
    cursor: pointer;
}

3:然后我们看看样式是什么样子吧:

登录注册页面连接数据库并完成注册(一)

登录注册页面连接数据库并完成注册(一)

 4:因为登录注册是在一个页面上面显示的,点击登录会把登录这个div页面隐藏,然后显示注册的div页面.利用的是点击事件;剩下的请看第二章哦!!!

 登录注册页面连接数据库并完成注册(一)文章来源地址https://www.toymoban.com/news/detail-507856.html

到了这里,关于登录注册页面连接数据库并完成注册(一)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • MVC框架实现用户登录注册功能(连接数据库)

    一、简单理解MVC框架 二、项目结构 三、项目源码 3.1 User 3.2 UserDao 3.3 RegisterDao 3.4 servletControll 3.5 servletControllRegister 3.6 web.xml 3.7 login.jsp 3.8 register.jsp 3.9 success.jsp 3.10 failure.jsp  四、实现效果 总结 本篇文章主要介绍利用MVC框架去实现一个简单的用户登录注册功能,内容主

    2024年02月06日
    浏览(51)
  • Flutter框架实现登录注册功能,不连接数据库

    要在Flutter框架中实现登录和注册功能,而不连接数据库,可以使用本地存储来存储用户信息。以下是一个简单的示例,演示如何使用本地存储来实现登录和注册功能。 首先,我们需要添加 shared_preferences 插件到 pubspec.yaml 文件中: 然后,在 lib 文件夹中创建一个新的文件夹

    2024年02月08日
    浏览(34)
  • JavaWeb实现简易的注册登录功能(与数据库连接)

    一、创建数据库表连接 这里我们创建一个数据库名为db_user,创建库的使用可视化工具很简单就不细说了,下面sql代码块是我们创建一个简易用户表为了方便我们后续进行登录注册操作。 下面就是建好的表: 1、建一个与数据库连接的file文件:db.properties 二、创建前端页面 1、

    2024年01月19日
    浏览(40)
  • 前端注册登录页面数据库交互(h5+css+php+mysql+axios)

    一个登录注册界面,并使用前端数据库实现登陆注册功能  首先是index.html 直接在index.html里面写了用axios,实现注册和登录 效果图 登录注册滑动实现 script.js style.css 然后是登录和注册的php login.php register.php

    2024年02月11日
    浏览(34)
  • java连接数据库实现登录与注册小功能(小白版)

    准备工作: 创建数据库stu;        create database stu charset=utf8; 使用数据库stu;            use stu; 创建用户表user(id,username,password,nick) create table user(id int primary key auto_increment,username varchar(50),password varchar(50),nick varchar(50));   1.开始创建springboot工程,勾选Web-spring Web,  SQL-MyBatis Frame

    2024年02月08日
    浏览(34)
  • Java--用户登录/注册界面(连接Mysql数据库)并可以通过验证码登录

    1 效果展示 (1)登录界面 (2)注册界面 (3)动图展示 2 内容说明 (1)开发前,需引入一个连接Mysql 数据库驱动mysql-connector-java-5.1.30-bin.jar包 提取码:6666 (2)构建路径 (3)需要下载xampp软件 xampp软件下载 提取码:2255 xampp软件包含 Apache Web服务器、 Mysql Web服务器、Filezilla

    2024年02月09日
    浏览(45)
  • Java实现连接数据库验证登录和注册(附详细知识点讲解)

    学完Java基础后,一般会做个项目练手(上一篇博客有讲到 Java在线聊天室课程设计 ) 当中肯定会涉及到 登录验证 ,但没学过数据库 😅,不知道如何操作;只能把用户账户密码预存在一个txt文本当中,然后通过IO流读取验证 ⭐ 最后去搜相应的资料和网课进行学习,现在问题

    2024年02月02日
    浏览(40)
  • 微信小程序登录与注册(没有连接数据库)(2023年3月31日)

    提示:以下是本篇文章正文内容,下面案例可供参考 在登录表单里,输入账号、密码进行登录,在账号、密码输入框里都有友好的提示信息;登录按钮 默认是灰色不可用状态,只有输入内容后,才会变为可用状态;在登录按钮的下面提供手机快速注 册、企业用户注册、找回

    2024年02月08日
    浏览(44)
  • arkTS开发鸿蒙OS应用(登录页面实现,连接数据库)

    喜欢的朋友可在抖音、小红书、微信公众号、哔哩哔哩搜索“淼学派对”。知乎搜索“编程淼”。

    2024年03月24日
    浏览(36)
  • 使用javaweb实现登录注册页面,并且对功能和业务进行分层 用户登录成功跳转到主页并展示数据库的商品的信息

    一、Servlet+JSP+JavaBean开发模式(MVC)介绍 Servlet+JSP+JavaBean模式(MVC)适合开发复杂的web应用,在这种模式下,servlet负责处理用户请求,jsp负责数据显示,javabean负责封装数据。 Servlet+JSP+JavaBean模式程序各个模块之间层次清晰,web开发推荐采用此种模式。 这里以一个最常用的用户登录

    2024年02月03日
    浏览(44)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包