9.23

js 实现登录界面
在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function checkForm() {
            var name = document.getElementById("username").value;
            if (name.length < 6) {
                alert("长度太短");
                return false;
            }
            var ps= document.getElementById("password").value;
            var reps = document.getElementById("repassword").value;
            if (ps != reps){
                alert("两次输入的密码不同");
                return false;
            }
            var phone= document.getElementById("mobile").value;
            if (!/^1(3|4|5|6|7|8|9)\d{9}$/.test(phone)){
                alert("手机格式不对");
                return false;
            }
            var email = document.getElementById("email").value;
            if (!/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/.test(email)){
                alert("邮箱格式不对");
                return false;
            }
        }
    </script>
</head>
<body>
<form action="#">
    <div>用户名:<input id="username" type="text"></div>
    <div>密码:<input id="password" type="password"></div>
    <div>确认密码:<input id="repassword" type="password"></div>
    <div>手机号码:<input id="mobile" type="number"></div>
    <div>邮箱:<input id="email" type="text"></div>
    <div><input type="submit" value="注册" onclick="checkForm()"></div>
</form>
</body>
</html>

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        function selectOne() {
            var lefts = document.getElementById("leftselect");
            var options = lefts.options;
            var rightselect = document.getElementById("rightselect");
            for (var i = 0; i < options.length; i++) {
                var option1 = options[i];
                if (option1.selected) {
                    rightselect.appendChild(option1)
                }
            }
        }

        function selectAll() {
            var all = document.getElementById("leftselect");
            var options = all.options;
            var a = options.length;
            var rightselect = document.getElementById("rightselect");
            for (var i = 0; i < a; i++) {
                var option1 = options[i];
                rightselect.appendChild(option1)
            }
        }

        function selectOner() {
            var right = document.getElementById("rightselect");
            var options = right.options;
            var leftselect = document.getElementById("leftselect");
            for (var i = 0; i < options.length; i++) {
                var option1 = options[i];
                if (option1.selected) {
                    leftselect.appendChild(option1)
                }
            }
        }

        function selectAllr() {
            var all = document.getElementById("rightselect");
            var options = all.options;
            var leftselect = document.getElementById("leftselect");
            var a=options.length;
            for (var i=0;i< a;i++) {
                var option1 = options[i];
                leftselect.appendChild(option1)
            }
        }
    </script>
</head>
<body>
<table width="400px" border="1px" >
    <tr>
        <td>分类名称</td>
        <td><input type="text" value="手机数码"/></td>
    </tr>
    <tr>
        <td>分类描述</td>
        <td><input type="text" value="这里都是手机数码"/></td>
    </tr>
    <tr>
        <td>分类商品</td>
        <td>
            <div style="float: left">
                已有商品<br/>
                <select multiple="multiple" id="leftselect" ondblclick="selectOne()">
                    <option>华为</option>
                    <option>小米</option>
                </select>
                <br/>
                <a href="#" onclick="selectOne()">&gt;&gt;</a>
                <br/>
                <a href="#" onclick="selectAll()">&gt;&gt;&gt;</a>
            </div>
            <div style="float: right">
                未有商品<br/>
                <select multiple="multiple" id="rightselect" ondblclick="selectOner()">
                    <option>苹果</option>
                    <option>三星</option>
                </select>
                <br/>
                <a href="#" onclick="selectOner()">&lt;&lt;</a>
                <br>
                <a href="#" onclick="selectAllr()">&lt;&lt;&lt;</a>
            </div>
        </td>
    </tr>
    <tr>
        <td><input type="submit" value="提交"/></td>
    </tr>
</table>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值