实例
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <title>独立完成一个用户注册表单</title> </head> <body> <h3>用户注册</h3> <hr> <form action="" method="post"> <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个字符"> </p> <p> <label for="email">邮箱:</label> <input type="email" name="email" id="email" placeholder="example@email.com"> </p> <p> <label for="age">年龄:</label> <input type="number" name="age" id="age" min="20" max="60"> </p> <p> <label for="birthday">生日:</label> <input type="date" name="birthday" id="birthday"> </p> <p> <label for="comment">简介:</label> <textarea name="comment" id="comment" cols="30" rows="10" maxlength="50"></textarea> </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="secret" checked><label for="secret">保密</label> </p> <p> <label for="code">爱好:</label> <input type="checkbox" name="hobby" id="read" ><label for="read">阅读</label> <input type="checkbox" name="hobby" id="code" checked><label for="code">编程</label> <input type="checkbox" name="hobby" id="travel"><label for="travel">旅游</label> </p> <p> <label for="">课程:</label> <select name="course" id="course"> <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">phpthink</option> </optgroup> </select> </p> <p> <input type="submit" name="submit" value="提交"> </p> </form> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例