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>    

    </form>

</body>

</html>

原文链接:https://www.cnblogs.com/kukai/p/12312831.html

原创文章,作者:优速盾-小U,如若转载,请注明出处:https://www.cdnb.net/bbs/archives/33077

(0)
上一篇 2025年4月20日
下一篇 2025年4月20日

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

优速盾注册领取大礼包www.cdnb.net
/sitemap.xml