原文:http://www.matiasmancini.com.ar/html5form_en.php
大致将要点翻译下:
在HTML5中,验证输入框等都可以不用JAVASCRIPT就能实现了,现在只有少部分浏览器
支持这个功能;现在,可以使用jquery插件去模拟这个功能了。安装:
<head>
//jQuery library
<script src="http://code.jquery.com/jquery-1.4.2.min.js%22%3E%3C/script>
//jQuery.html5form plugin
<script src="http://html5form.googlecode.com/svn/trunk/jquery.html5form-min.js">
</script>
<script>
$(document).ready(function(){
$('#myform').html5form();
});
</script>
</head>
HTML5的一些特征如下:
1)属性placeholder
<input type="text" placeholder="Full Name"/>
placeholder的作用是,当你在文本框没输入任何东西,时,
会自动光标停留在文本框中
2)EMAIL
<input type="email" name="email" id="email"/>
3)TEXTAREA
<textarea maxlength="60" name="comment" id="comment"/>
4) URL
<input type="url" name="website" placeholder="http://%22/>
这个表明必须输入的是url
使用这个控件
<script>
$('#myform').html5form({
async : false, // cancels the default submit method.
method : 'GET', // changes the request method.
action : 'respuesta.php', // changes the action method.
responseDiv : '#respuesta' // a content div to get the callback function response.
})
</script>
5 当有多个form时
<script>
$('#myform_one').html5form({
method: 'POST',
});
$('#myform_two').html5form({
method: 'GET'
});
</script>
支持所有浏览器:
<script>
$('#myform').html5form({
allBrowsers: true
});
</script>
下载见:
http://html5form.googlecode.com/svn/trunk/jquery.html5form-min.js
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
2008-08-30 介绍一款ajax的auotocomplete框架
2008-08-30 ajax自动保存用户的输入
2008-08-30 php中安全补充
2006-08-30 spring+hibernate+其他应用组装心得小结
2005-08-30 使用asp.net 2.0和SQL SERVER 2005构建多层应用
2005-08-30 (转)mysql同步复制