惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Jina AI
Jina AI
Recent Announcements
Recent Announcements
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
A
About on SuperTechFans
Vercel News
Vercel News
博客园 - 【当耐特】
爱范儿
爱范儿
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
D
Docker
博客园 - 叶小钗
The Cloudflare Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
H
Help Net Security
I
InfoQ
博客园 - 三生石上(FineUI控件)
博客园 - Franky
Microsoft Azure Blog
Microsoft Azure Blog
The GitHub Blog
The GitHub Blog
大猫的无限游戏
大猫的无限游戏
MongoDB | Blog
MongoDB | Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

博客园 - jackyrong的世界

本BLOG迁移到javaeye .net中javascript去调用webservice - jackyrong的世界 - 博客园 asp.net 4中的新特性之一:控制URL长度 vs.net 2010中使用code snippets - jackyrong的世界 asp.net 2010中jquery调用webservice php中存储IP的一个不错的方法 介绍又一个不错的TOMCAT监控好工具probe jquery中输入验证中一个不错的效果 - jackyrong的世界 - 博客园 软件工程心理学系列11之如何应对客户的严厉批评 团队中不能只有梅西呀 mysql 性能学习1 6个PHP漏洞扫描工具 监控JAVA应用的好工具javamelody (转)Math.Round() -- c# 与 java的区别 云估算? apache 的mod-status 如何带平均年龄小的团队 本人售买一本o'relliy 出版社的《WCF服务编程》书,有意的广州朋友当面交易 小结php的字符串用法 - jackyrong的世界 - 博客园
一个模仿HTML5功能的jquery控件 - jackyrong的世界 - 博客园
jackyrong的世界 · 2010-08-30 · via 博客园 - jackyrong的世界

原文: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