HTML INPUT系列使用

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <form enctype="multipart/form-data">
        <div>
            <p>请选择性别:</p>
            男:<input type="radio" name="gender" value="1" checked="checked"/>
            女:<input type="radio" name="gender" value="2"/>
            <p>爱好</p>
            篮球:<input type="checkbox" name="favor" value="1"/>
            足球:<input type="checkbox" name="favor" value="2"/>
            排球:<input type="checkbox" name="favor" value="3"/>
            皮球:<input type="checkbox" name="favor" value="4"/>
            网球:<input type="checkbox" name="favor" value="5"/>
            <p>技能</p>
            撩妹:<input type="checkbox" name="skill" />
            写代码:<input type="checkbox" name="skill"/>
            <p>上传文件</p>
            <input type="file" name="fname">
        </div>
        <input type="submit" value="提交">
        <input type="reset" value="重置">

    </form>
</body>
</html>
View Code
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <form action="http://172.17.205.193:8888/index" method="post"><!--action提交表单。action填写url提交表单地址,method请求方式,默认是get-->
        <input type="text" name="user"/>
        <input type="text" name="email"/>
        <input type="password" name="pwd"/>
        <!-- 提交表单以字典的形式-->
        <input type="button" value="登录1"/>
        <input type="submit" value="登录2"/>
    </form>
</body>
</html>
View Code
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <form action="https://www.sogou.com/web" >
        <input type="text" name="query" value="test"/>
        <input type="submit" value="搜索"/>
    </form>

</body>
</html>
View Code

        - input系列:
            input type="text"     -name属性 value是默认值
            input type="password"    -name属性
            input type="button" -普通按钮
            input type="submit" -提交按钮 value='提交'按钮名称
            
            input type="radio" name="gender" value="1" checked="checked"  -value,name(name相同就进行互斥)。单选。checked默认被选上    
            input type="checkbox" name="favor" value="5" 复选框,value,name属性(批量获取数据)
            
            input type="file" name="fname" -上传文件依赖form表单的一个属性enctype="multipart/form-data" 表示一点一点发送服务器
            input type="reset" value="重置" -重置
           

原文地址:https://www.cnblogs.com/anhao-world/p/14042585.html