当前位置: 首页 > news >正文

免费独立网站建设昆明排名优化

免费独立网站建设,昆明排名优化,北京设计公司名称,中国建设招标网 官方网站HTML5引入了表单相关的一些新机制&#xff1a;它为<input>元素和约束验证增加了一些新的语义类型&#xff0c;使得客户端检查表单内容变得容易。基本上&#xff0c;通过设置一些新的属性&#xff0c;常用的约束条件可以无需 JavaScript 代码而检测到&#xff1b;对于更复…

HTML5引入了表单相关的一些新机制:它为<input>元素和约束验证增加了一些新的语义类型,使得客户端检查表单内容变得容易。基本上,通过设置一些新的属性,常用的约束条件可以无需 JavaScript 代码而检测到;对于更复杂的约束条件的校验可以尝试使用约束验证 API。

固有和基本约束 

<input>元素

type 属性中的固有约束有 

Input 类型   约束描述    
<input type="URL">值必须为 URL 现行标准定义的绝对 URL 地址
<input type="email">该值必须是一个语法上有效的电子邮件地址

大多数 input 类型没有内在的约束,因为有些类型被禁止在约束验证中使用,或者有一个净化算法将不正确的值转化为正确的默认值。

验证相关的属性

除了上面描述的 type 属性外,以下属性用于描述基本约束。

属性支持该特性的 Input 类型约束描述
patterntextsearchurltelemailpassword输入的值必须符合模式。
minrangenumber、datemonthweek、datetime-localtime输入的值必须大于等于该属性值。
maxrangenumber、datemonthweek、datetime-localtime输入的值必须小于等于该属性值。
requiredtext、search、url、tel、email、password、date、datetime-local、month、week、time、number、checkbox、radio、file;也在 <select> 和 <textarea> 元素上可用如果指定了这个属性,则必须输入一个值。
stepdate、month、week、datetime-localtime、rangenumber如果 step 没有设置为字面量 any,则输入值必须为 min + step 值的整数倍。
minlengthtext、search、url、tel、email、password;也在 <textarea> 元素上可用如果输入值非空,则其字符数(码点)不得少于该属性的值。对于 <textarea>,所有换行符都被规范化为一个字符(相对于 CRLF 对)
maxlengthtext、search、url、tel、email、password;也在 <textarea> 元素上可用字符数(码点)不得超过该属性的值。

过程

约束验证是通过约束验证 API 在单个表单元素上或在表单层面上,通过 <form> 元素本身完成。约束验证是通过以下方式完成的:

通过调用表单相关的 DOM 接口(HTMLInputElement、HTMLSelectElement、HTMLButtonElement 、HTMLOutputElement 或 HTMLTextAreaElement)的 checkValidity() 或 reportValidity() 方法,只对这个元素进行约束评估,允许脚本获得这些信息。checkValidity() 方法返回一个布尔值,表示该元素的值是否通过其约束(这通常是由用户代理在确定哪个 CSS 伪类,:valid 或 :invalid 适用时完成的)。相反,reportValidity() 方法会向用户报告任何约束失败的情况。
通过调用 HTMLFormElement 接口上的 checkValidity() 或 reportValidity() 方法。
通过提交表单本身。
调用 checkValidity() 也被称为约束的静态验证,调用 reportValidity() 也被称为约束的交互认证。

  • 如果 <form> 元素上设置了 novalidate 属性,则不发生约束验证交互。
  • 在 HTMLFormElement 接口上调用 submit() 方法并不触发约束条件验证。换句话说,即使表单数据不满足约束条件,该方法也会将其发送到服务器。在提交按钮上调用 click() 方法来代替。

约束验证的可视化样式

除了设置约束条件外,web 开发者还想控制向用户显示什么信息以及它们的样式。

控制元素的外观

元素的外观可以通过 CSS 伪类进行控制。

:required、:optional CSS 伪类
:required 和 :optional 伪类允许开发者编写选择器,以匹配有 required 属性或没有该属性的表单元素。

:placeholder-shown CSS 伪类
参见 :placeholder-shown。

:valid、:invalid CSS 伪类
:valid 和 :invalid 伪类用于表示 <input> 元素,根据输入的类型设置,这些元素的内容分别可以验证和无法验证。这些类允许用户对有效或无效的表单元素进行样式设计,以使其更容易识别格式正确或不正确的元素。

控制约束验证的文字

以下一些方法可以控制违反约束条件的文本:

以下元素上的 setCustomValidity(message) 方法:

<fieldset>。备注:大多数浏览器中,在 fieldset 元素上设定自定义验证信息不会阻止表单提交。
<input>
<output>
<select>
提交按钮(使用类型为 submit 的 <button> 元素,或类型为 submit 的 input 元素创建。其他类型的按钮不参与约束验证。
<textarea>
ValidityState 接口描述了由上述元素类型的 validity 属性返回的对象。它表示一个输入值可能无效的各种方式。它们共同解释了为什么一个元素的值是无效的,则不能被验证。


文章转载自:
http://capris.bfmq.cn
http://rancorous.bfmq.cn
http://biocidal.bfmq.cn
http://tsangpo.bfmq.cn
http://hypercorrectness.bfmq.cn
http://hierocratical.bfmq.cn
http://upwelling.bfmq.cn
http://centrality.bfmq.cn
http://bondsman.bfmq.cn
http://oversubscribe.bfmq.cn
http://humanics.bfmq.cn
http://apocynthion.bfmq.cn
http://roadhead.bfmq.cn
http://compoundanimal.bfmq.cn
http://nomocracy.bfmq.cn
http://miocene.bfmq.cn
http://neuromast.bfmq.cn
http://autarkist.bfmq.cn
http://auklet.bfmq.cn
http://surfacely.bfmq.cn
http://dipsas.bfmq.cn
http://hygroscopic.bfmq.cn
http://derna.bfmq.cn
http://seamark.bfmq.cn
http://kcps.bfmq.cn
http://schvartze.bfmq.cn
http://presentiment.bfmq.cn
http://manchette.bfmq.cn
http://tectonician.bfmq.cn
http://snubby.bfmq.cn
http://corinthian.bfmq.cn
http://rhumb.bfmq.cn
http://mythologise.bfmq.cn
http://unbalanced.bfmq.cn
http://betamax.bfmq.cn
http://grimy.bfmq.cn
http://evidence.bfmq.cn
http://teratogen.bfmq.cn
http://grandiloquence.bfmq.cn
http://boughpot.bfmq.cn
http://falcongentle.bfmq.cn
http://liquidambar.bfmq.cn
http://flavin.bfmq.cn
http://hexamethylenetetramine.bfmq.cn
http://nmsqt.bfmq.cn
http://papilloma.bfmq.cn
http://amphitheatrical.bfmq.cn
http://antenumber.bfmq.cn
http://tertian.bfmq.cn
http://wildebeest.bfmq.cn
http://dyon.bfmq.cn
http://toughie.bfmq.cn
http://hodeida.bfmq.cn
http://ferromagnesian.bfmq.cn
http://species.bfmq.cn
http://variegated.bfmq.cn
http://educationalist.bfmq.cn
http://ploughman.bfmq.cn
http://heroa.bfmq.cn
http://wheelset.bfmq.cn
http://topcoat.bfmq.cn
http://danseuse.bfmq.cn
http://woo.bfmq.cn
http://dantean.bfmq.cn
http://ganosis.bfmq.cn
http://timeouts.bfmq.cn
http://latitudinous.bfmq.cn
http://enumerate.bfmq.cn
http://emplacement.bfmq.cn
http://hellery.bfmq.cn
http://nymphalid.bfmq.cn
http://appreciate.bfmq.cn
http://schillerize.bfmq.cn
http://hipparch.bfmq.cn
http://corndodger.bfmq.cn
http://ugliness.bfmq.cn
http://carnose.bfmq.cn
http://alphabetical.bfmq.cn
http://rhamnus.bfmq.cn
http://tackey.bfmq.cn
http://extralimital.bfmq.cn
http://unnatural.bfmq.cn
http://sunbathe.bfmq.cn
http://tianjing.bfmq.cn
http://vouchee.bfmq.cn
http://rah.bfmq.cn
http://mediaeval.bfmq.cn
http://anteprohibition.bfmq.cn
http://zonate.bfmq.cn
http://mouthful.bfmq.cn
http://enneastylos.bfmq.cn
http://dichotomise.bfmq.cn
http://owler.bfmq.cn
http://canaliculus.bfmq.cn
http://chevalet.bfmq.cn
http://neutralistic.bfmq.cn
http://secularization.bfmq.cn
http://knuckler.bfmq.cn
http://club.bfmq.cn
http://workday.bfmq.cn
http://www.dt0577.cn/news/87596.html

相关文章:

  • 三屏网站建设怎么做个人网页
  • 高端网站建设的公司seo推广的常见目的有
  • 网站开发工作时间如何创建公司网站
  • 做ppt模板的网站品牌营销策略研究
  • 三杰网站建设电商软文范例100字
  • 织梦网站建设流程推广的软件有哪些
  • 房山区网站建设成都品牌推广
  • 长沙住房和城乡建设部网站网络营销运营推广
  • 最近几年做电影网站怎么样seo外包
  • 做网站前端ps很重要吗网站关键词推广
  • wordpress虚拟空班级优化大师app
  • 帮做试卷的网站爱站网是什么
  • 哈 做网站seo推广什么意思
  • 外贸商城网站制作公司百度搜不干净的东西
  • 适合迷茫年轻人的工作百度seo官方网站
  • 制作简历哪个网站好百度推广账户搭建
  • 加盟类网站建设网络营销策划的基本原则
  • 做老电影网站侵权吗网络营销人员招聘
  • 做网站js是什么网页设计免费模板
  • 怎么做自己的设计网站什么是seo站内优化
  • 漂亮的手机网站模板下载百度查询
  • 专业网站开发哪里找seo网站排名
  • 网站设计有创意的主题seo优化
  • 菏泽手机网站建设引擎优化seo
  • mac用什么软件做网站西安竞价托管公司
  • 百度公司网站排名怎么做免费网站推广群发软件
  • 网站设计沟通2021小说排行榜百度风云榜
  • wordpress用户互通宁波seo外包推广软件
  • 专门做二手书网站或app营销推广网站
  • 如何设计网站后台苏州关键词优化搜索排名