初识html

表单浅谈

  • action : 表单提交的位置,可以是网站,也可以是请求处理地址
    method : post ,get 提交方式
    get提交方式: 我们可以在url中看到我们提交的信息,不安全,高效
    post: 比较安全,传输大文件。
  • 文本输入框:input type=“text” name=“username”
    value=“sssl” :默认初始值
    maxlength=“8” : 最大限制字符数
    size=“30” : 文本框的长度
    readonly : 只读模式
    disabled : 不能操作
    hidden : 隐藏内容
    placeholder: 提示信息
    required : 非空判断
    pattern: 正则表达式
  • 单选框标签
    input type=“radio”
    value=“boy” :单选框的值
    name=“sex” : 表示组的含义
  • 多选框
    input type=“checkbox” value=“sleep” name=“hobby”
  • 按钮:
    input type=“button” 普通按钮
    input type=“image” 图像按钮
    input type=“submit” 提交按钮
    input type=“reset” 重置按钮
  • 文件域
    input type=“file” name=“files”
    input type=“button” value=“上传” name=“upload”

正则表达式

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登陆注册</title>
</head>
<body>

<!--
结构化标准语言:html,xml
表现标准语言
行为标准
-->
<h1>注册</h1>
<!--表单from
action : 表单提交的位置,可以是网站,也可以是请求处理地址
method : post ,get 提交方式
get提交方式: 我们可以在url中看到我们提交的信息,不安全,高效
post: 比较安全,传输大文件。
-->


    <form action="7.媒体元素.html" method="get">
    <!--文本输入框:input type="text" name="username"
    value="sssl" :默认初始值
    maxlength="8" : 最大限制字符数
    size="30" : 文本框的长度
    readonly : 只读模式
    disabled : 不能操作
    hidden : 隐藏内容
    placeholder: 提示信息
    required : 非空判断
    pattern: 正则表达式
    -->
    <p>名字: <input type="search" name="username" maxlength="8" size="30" placeholder="请输入用户名" required></p>
    <!--密码框:<input type="password" name="pwd">-->
    <p>密码: <input type="password" name="pwd" value="123456" required></p>

<!--单选框标签
        input type="radio"
        value="boy" :单选框的值
        name="sex" : 表示组的含义
    -->
        <p>性别:
            <input type="radio" value="boy" name="sex" checked/><input type="radio" value="girl" name="sex"/></p>
<!--
多选框
input type="checkbox" value="sleep" name="hobby"

-->

        <p>爱好:
            <input type="checkbox" value="sleep" name="hobby" checked disabled>睡觉
            <input type="checkbox" value="coding" name="hobby">代码
            <input type="checkbox" value="chat" name="hobby">聊天
            <input type="checkbox" value="game" name="hobby" checked disabled>游戏
        </p>

<!--        按钮:
input type="button" 普通按钮
input type="image"  图像按钮
input type="submit" 提交按钮
input type="reset"  重置按钮
-->
<p>按钮:
    <input type="button" name="butt1" value="点击变长">
    <input type="image" src="../resources/image/1.jpg" >
</p>




        <p>下拉框:
            <select name="列表名称">
                <option value="china" hidden>中国</option>
                <option value="japan">日本</option>
                <option value="usa"selected>美国</option>
                <option value="eth">瑞士 </option>
            </select>
        </p>

<!--        
文本域

-->
        <p>反馈:
            <textarea name="textarea" cols="10" rows="10">内容</textarea>
        </p>
        
<!--        文件域
input type="file" name="files"
input type="button" value="上传" name="upload"
-->
        <p>
            <input type="file" name="files">
            <input type="button" value="上传" name="upload" required>
        </p>

<!--邮件验证-->
        <p>邮箱:
            <input type="email" name="email" required>
        </p>
<!--url-->
        <p>URL:
            <input type="url" name="url" required>
        </p>

<!--数字-->
<p>商品数量:
    <input type="number" name="num" max="10" min="0" step="1" required>
</p>

<!--        滑块-->
        <p>音量:
            <input type="range" name="voice" min="0" max="10" step="1" required>
        </p>

<!--        搜索框-->
        <p>搜索:
            <input type="search" name="search" id="mark">
        </p>

        <p>
            <!--增强鼠标可用性-->
            <label for="mark">你点我试试</label>
            <input type="text">
        </p>

<!--https://www.jb51.net/article/76901.htm-->
        <p>自定义邮箱:
            <input type="text" name="diymail" pattern="^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$">
        </p>


        <p>
            <input type="submit" disabled>
            <input type="reset" value="清空表单">
        </p>
    </form>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值