天天看点

h5表单效果 小案例

<!DOCTYPE html>

<html >

<head>

    <meta charset="UTF-8">

    <title>Title</title>

    <style>

        body {

            margin: 0;

            padding: 0;

            background-color: #F7F7F7;

            font-family: '微软雅黑';

        }

        form {

            max-width: 640px;

            width: 100%;

            margin: 24px auto;

            font-size: 28px;

        }

        label {

            display: block;

            margin: 10px 10px 15px;

            font-size: 24px;

        }

        input {

            display: block;

            width: 100%;

            height: 40px;

            font-size: 22px;

            margin-top: 10px;

            padding: 6px 10px;

            color: #333;

            border: 1px solid #CCC;

            box-sizing: border-box;

        }

        .btn {

            margin-top: 30px;

        }

        .btn input {

            color: #FFF;

            background-color: green;

            border: 0 none;

            outline: none;

            cursor: pointer;

        }

    </style>

</head>

<body>

        <form action="">

                <fieldset>

                        <legend>学生档案</legend>

                        <label for="username">学生姓名</label>

                        <input type="text" name="username" id="username" required="required">

                        <label for="telephone">手机号</label>

                        <input type="tel" name="telephone" id="telephone" required="required">

                        <label for="email">邮箱</label>

                        <input type="email" name="email" id="email" required="required">

                        <label for="">所属学院</label>

                        <input type="text" id="" list="xueyuan" placeholder="请选择一个牛b 的学院">

                        <datalist id="xueyuan">

                                <option>IOS 学院</option>

                                <option>移动开发前段学院</option>

                                <option>javaEE+大数据学院</option>

                                <option>前端五期很牛B 学院</option>

                        </datalist>

                        <label>入学成绩:</label>

                        <input type="number" max="100" min="0" step="10" value="10" id="socre">                     

                        <label>入学日期</label>

                        <input type="date">

                        <label>毕业时间</label>

                        <input type="date">

                         <input type="submit" value="保存">

                </fieldset>

        </form>

            <script>

                        document.getElementById("socre").οninput=function(){

                               // alert(this.value)

                                document.getElementById("base").value=this.value;

                        }

            </script>

</body>

</html>

继续阅读