建设一个旅游网站,网站 多语言处理,深圳网站建设工作,做网站套模板form表单基本格式
form action method表单其它元素
/form
action“”#xff1a;表单提交url#xff08;地址#xff09;。
method“”#xff1a;表单提交方式#xff0c;有get、post两种请求。
get方式#xff1a;表单数据…form表单基本格式
form action method表单其它元素
/form
action“”表单提交url地址。
method“”表单提交方式有get、post两种请求。
get方式表单数据在页面地址栏中是可见的GET 最适合少量数据的提交浏览器会设定容量限制
post方式POST 的安全性更加因为在页面地址栏中被提交的数据是不可见的。对于数据传输没有大小限制
HTML 表单包含表单元素。
表单元素指的是不同类型的 input 元素、复选框、单选按钮、提交按钮等等
input框的不同类型
1.纯文本单行输入框
typetext:纯文本单行输入框
name:如果要正确地被提交每个输入字段必须设置一个 name 属性
input typetextnametextvaluehello
可选属性
1.value“”文本输入框具有一个默认值
2.placeholder请输入账号加入此属性文本框会有提示词
效果3.autocompleteoff:加入此属性之前文本框输入过的值不会显示
4.readonlyreadonly加入此属性输入框将只应许读不可进行写操作
5.disableddisabled文本输入框禁用
6.requiredrequired提交信息时如果输入框为空会提示输入不能为空
7.autofocusautofocus当打开页面时此input框会自动获取光标焦点
2.密码输入框
typepassword:密码输入框输入密码时密码将被隐藏化
input typepasswordnamepassword
3.单选按钮
typeradio:单选按钮。必须要将name的值设置为一样的才能实现单选的效果
请选择性别女input typeradiovalue女namegender
男input typeradiovalue男namegender
效果 1.checkedchecked加入该属性该元素将默认被选中2.label/label:用该标签包裹点击文字也能实现选中效果
label男input typeradiovalue男namegender/label
效果 4.多选按钮
typecheckbox:多选框
多选按钮1input typecheckboxvalue多选按钮1namebook2
多选按钮2input typecheckboxvalue多选按钮2namebook2
多选按钮3input typecheckboxvalue多选按钮2namebook2 5.复位按钮
typereset:将表单恢复到最初的样子
input typeresetvalue复位按钮
效果 6.提交按钮
typesubmit:提交表单
input typesubmit value提交
7.图像按钮
typeimage:点击图片可进行表单的提交相当于提交按钮
input typeimagevaluesrc(url)
1.width200设置图片宽度
2.height200设置图片高度
input typeimagevaluesrcwidth200height200 8.文件选择按钮
typefile
文件选择input typefilevalue选择文件
效果 9.邮箱输入框
typeemail
邮箱input typeemail nameemail
10.数字选择器
typenumber
数字选择input typenumber namenumbermax10 min1
1.max10:设置最大可取值到10
2.min1:设置最小可取值为1
效果 11.颜色选取器
typecolor
input typecolor namecolor//默认为黑色 效果 12.日期选取 年、月、日
typedate
input typedate namedate
效果 13.时间选择器时、分
typetime input typetime nametime
14.日期选择器年、月、日、时、分
typedatetime-local
input typedatetime-local namedate-local textarea多行文本域可输入多行文本
textarea maxlength100 namename cols100 rows5 /textarea
1.maxlength100:设置文本最大可输入字符
2.cols100:以100个字符个数设置文本宽度
3.rows5:以5个字符个数设置文本高度 select下拉列表
选择城市select nameselectoption value1北京/option
!-- selectedselected:默认选择--option value2 selectedselected上海/optionoption value3重庆/option/select
1.option/option:添加下拉列表的可选择项
效果
2.multiplemultiple在select中加入此属性下拉列表是展开形式
选择城市select nameselect multiplemultipleoption value1北京/option
!-- selectedselected:默认选择--option value2 selectedselected上海/optionoption value3重庆/option/select
效果