实例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>用户注册表单</title> </head> <body> <div style="background-color: lightblue;width:400px;height: 600px;padding:30px 100px"> <h2>用户注册</h2> <form action="" method="get"> <p> <label for="username">账号:</label> <input type="text" name="username" id="username" placeholder="不超过8个字符" autofocus required> </p> <p> <label for="password">密码:</label> <input type="password" name="password" id="password" placeholder="6-12个字母和数字组成" autofocus required> </p> <p> <label for="email">邮箱:</label> <input type="email" name="email" id="email" placeholder="example@mail.com" required> </p> <p> <label for="age">年龄:</label> <input type="number" name="age" id="age" min="18" max="100"> </p> <p> <label for="birthday">生日:</label> <input type="date" name="birthday" id="birthday"> </p> <p> <!--select下拉列表--> <label for="course">课程:</label> <select name="course" id="course"> <option value="0">请选择</option> <optgroup label="前端:"> <option value="1">html5</option> <option value="2">css3</option> <option value="3">javascript</option> </optgroup> <optgroup label="后端"> <option value="4">php</option> <option value="5">mysql</option> <option value="6">thinkphp</option> </optgroup> </select> </p> <p> <label for="eat">爱好:</label> <input type="checkbox" name="hobby[]" id="eat"><label for="eat">吃饭</label> <input type="checkbox" name="hobby[]" id="sleep" checked><label for="sleep">睡觉</label> <input type="checkbox" name="hobby[]" id="watchTV"><label for="watchTV">看电视</label> </p> <p> <label for="male">性别:</label> <input type="radio" name="gender" id="male"><label for="male">男</label> <input type="radio" name="gender" id="female"><label for="female">女</label> <input type="radio" name="gender" id="secrecy"><label for="secrecy">保密</label> </p> <p> <label for="comment">备注:</label> <textarea name="comment" id="comment" cols="30" rows="10" maxlength="30" placeholder="不超过30字"></textarea> </p> <button type="submit">提交</button> </form> </div> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例