zoukankan      html  css  js  c++  java
  • 学习进度6

    今天主要学习了一些JavaScript的内容

    JavaScript常用来为网页添加各式各样的动态功能,为用户提供更流畅美观的浏览效果。通常JavaScript脚本是通过嵌入在HTML中来实现自身的功能的

    可以说大部门时候是来当函数来验证某些内容的

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title></title>
            <script>
                function check(){
                    var username=document.getElementById("username").value;
                    if(username==""){
                        alert("用户名不能为空!");
                        return false;
                    }
                    var password=document.getElementById("password").value;
                    if(password ==""){
                        alert("密码不能为空!");
                        return false;
                    }
                    var repassword=document.getElementById("repassword").value;
                    if(password!=repassword){
                        alert("两次密码不一致");
                        return false;
                    }
                }                                
            </script>
        </head>
        <body>
            <form action="#" method="get" onsubmit="return check()">
                用户名:<input type="text" name="username" id="username" placeholder="请输入用户名"/><br />
                密码:<input type="password" name="password" id="password"/><br />
                确认密码:<input type="password" name="repassword" id="repassword"/><br />
                性别:<input type="radio" name="sex" value="男"/><input type="radio" name="sex" value="女" checked="checked"/><br />
                提交按钮:<input type="submit" value="注册"/><br />
                重置按钮:<input type="reset" />
            </form>
            
        </body>
    </html>
    View Code

    © 版权声明
    文章版权归作者所有,未经允许请勿转载。
    THE END
  • 相关阅读:
    LeetCode 654. 最大二叉树
    LeetCode 617. 合并二叉树
    LeetCode 234. 回文链表
    LeetCode 328. 奇偶链表
    LeetCode 24. 两两交换链表中的节点
    LeetCode 21. 合并两个有序链表
    LeetCode 876. 链表的中间结点
    顺序表的定义及其相关基本操作
    LeetCode 206. 反转链表
    LeetCode 111. 二叉树的最小深度
  • 原文地址:https://www.cnblogs.com/xp-thebest/p/12288857.html
Copyright © 2011-2022 走看看