html表单1:表单基础

表单

网页中的一个交互区域

form表单标签属性

action:选择将表单传递给谁处理

target:选择跳到那个页面(_self/_blank...)

method:选择请求方式

input输入控件

type="text"表示为输入框 ,name属性中传入接收方规定的参数

value代表输入框中的默认值

maxlength属性代表输入的最大长度

button按钮控件
代码如下
html 复制代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form action="https://www.baidu.com/s" target="_self" method="get">
        <!-- action选择将表单传给谁处理 -->
        <!-- target选择跳到哪个页面 -->
        <!-- method选择请求方式 -->
        <input type="text" name="wd" id="">
        <!-- 输入框 name中需要传递接收方规定的参数 -->
        <button>搜索</button>
        <!-- 按钮 -->
    </form>
    <form action="https://search.jd.com/search" target="_blank">
        <!-- 选择将表单传给谁处理 -->
        <input type="text" name="keyword" id="">
        <!-- 输入框 name中需要传递接收方规定的参数 -->
        <button>搜索</button>
        <!-- 按钮 -->
    </form>
    <form action="">
        账户: <input type="text" name ="account" value="ooo" maxlength="10"><br>
        密码: <input type="password" name ="password" value="123"><br>
        <button>确认</button>
    </form>
</body>
</html>
相关推荐
传人once5 小时前
页面中心圆圈放大效果如何写
开发语言·javascript·ecmascript
用户033307413955 小时前
TypeScript using 与 AsyncDisposableStack:在真实服务端代码中协调多资源清理
前端
daisychey5 小时前
用 Playwright 做多平台内容分发,我踩过的 8 个坑
前端
IT_陈寒6 小时前
为什么你应该学习JavaScript?
前端·人工智能·后端
大龄秃头程序员6 小时前
iOS冷启动监控Demo
前端
光影少年6 小时前
为什么 JavaScript 中 0.1 + 0.2 !== 0.3,如何让其相等?
前端·javascript·算法
掘金酱7 小时前
[稀土掘金 × 火山引擎] AI用量周榜冲刺赛|获奖名单公示
前端·人工智能·后端
泡泡oO7 小时前
“如果你还在用Superpowers,那我不要和你说话”
前端·后端·全栈
维克兜率天7 小时前
趋势过滤:避免被“假突破“反复打脸
前端
8年区块链老兵8 小时前
一篇文章教会你:用区块高度读懂比特币链上的每一笔交易
前端