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>
相关推荐
用户62960593247057 小时前
一次位置调整引发的画布失忆:深入 Vue2 虚拟 DOM 复用机制
前端·vue.js
Sterting7 小时前
条件渲染与列表渲染
前端·vue.js
__sjfzllv___7 小时前
在职前端Leader学习/转行 AI Agent -DAY28
前端
用户847181054197 小时前
LangChain中间件教程及DeepAgents应用
javascript·agent
不爱说话郭德纲7 小时前
uni-app x iOS 扫码模糊怎么办?AVFoundation 灰尘级别摄像头助你超广角聚焦
前端·uni-app·app
柒和远方7 小时前
V062:WebGPU 端侧推理与单例模式:从 Transformers.js 把大模型装进浏览器,到 Worker 线程的流式对话
前端
huabuyu7 小时前
INP 自动化归因与自愈:如何自动定位、修复并验证一次卡顿
前端·javascript
何时梦醒7 小时前
第一篇:项目概览 — 在浏览器里跑大模型,端侧 AI 的革命来了
前端·人工智能
何时梦醒7 小时前
第二篇:工程化搭建 — Vite + React + TypeScript + TailwindCSS 全解析
前端·人工智能
用户0332126663677 小时前
使用 Python 将 HTML 内容添加到 PowerPoint 演示文稿中
python·html