form表单

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        input[type="submit"]{
            /* color:green; */
            background-color: greenyellow;
        }
    </style>
</head>
<body>
    <!-- 表单的action属性值为表单提交的服务器地址  -->
    <form action="html001.html">
        <!-- 注意:数据要提交到服务器中,必须要为元素指定一个name属性值 -->
        姓名:<input type="text" name="username"><br>
        密码:<input type="password" name="password"><br>
        <!-- 单选按钮:
                    像这种选择框,必须指定一个value属性,name必须指定同一个
                     value属性最终会做为用户的填写值传递给服务器 
                    默认按钮选中 checked-->
        性别:<label for="male">男</label><input type='radio' id="male" name="sex" value="1">
            <label for="female">女</label><input type="radio" id="female" name="sex" value="2"><br>
            <!-- 多选按钮:
                    value属性最终会作为用户的填写值传递给服务器
                    默认按钮选中 checked-->
        兴趣:<label for="run">跑步</label><input type="checkbox" id="run" name="interest" value="1">
             <label for="ping-pang">乒乓</label><input type="checkbox" id="ping-pang" name="interest" value=2><br>
        <!-- 下拉列表 value值为用户的填写值传递给服务器   
                     默认选中属性 selected -->
             城市:<select name="city">
                <option value="beijing">北京</option>
                <option value="tianjin">天津</option>
                <option value="xi'an">西安</option>
        </select>    
        <input type="submit">
    </form>
</body>
</html>
posted @ 2020-02-15 17:31  玄空2  阅读(89)  评论(0编辑  收藏  举报