900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > jQuery和html5和css3实现圆角无刷新表单带输入验证的功能

jQuery和html5和css3实现圆角无刷新表单带输入验证的功能

时间:2020-10-18 07:47:26

相关推荐

jQuery和html5和css3实现圆角无刷新表单带输入验证的功能

web前端|js教程

jQuery,html5,css3,圆角,表单

web前端-js教程本文实例讲述了jQuery+html5+css3实现圆角无刷新表单带输入验证功能代码。分享给大家供大家参考。具体如下:

二维码群发广告源码,vscode 配置信息备份,ubuntu 如何pip,tomcat备份哪些文件,html 爬虫 c ,php表单提交中文乱码,贵阳谷歌seo营销公司,asp网站制作搜索代码,商家活动中心瀑布流模板lzw

这里实现圆角表单,圆角输入框,无刷新验证,漂亮唯美,是对这款基于HTML5/CSS3/jQuery来实现的表单效果的简要概括,用HTML5可以实现很多超乎寻常的效果,从此你会喜欢上HTML5,会骂一下万恶的IE,到现在IE8还不支持HTML5,正悲哀着呢。

pc协议易语言源码,vscode 大项目 很慢,ubuntu 挂起 远程,tomcat未配置实例,鸡身上爬虫,php7.0 新特性,seo中的28种原则,国外云服务器网站源码,招商网页模板lzw

先来看看运行效果截图:

创业社区源码,ubuntu看根大小,写爬虫 分析评价,php考卷,不朽的seolzw

具体代码如下:

html5+css3+jQuery圆角注册表单效果$(document).ready(function() {(function($) { $.InFieldLabels = function(label, field, options) { var base = this; base.$label = $(label); base.$field = $(field); base.$label.data("InFieldLabels", base); base.showing = true; base.init = function() { base.options = $.extend({}, $.InFieldLabels.defaultOptions, options); base.$label.css(position, absolute); var fieldPosition = base.$field.position(); base.$label.css({ left: fieldPosition.left, op: fieldPosition.top }).addClass(base.options.labelClass); if (base.$field.val() != "") { base.$label.hide(); base.showing = false; }; base.$field.focus(function() { base.fadeOnFocus(); }).blur(function() { base.checkForEmpty(true); }).bind(keydown.infieldlabel, function(e) { base.hideOnChange(e); }).change(function(e) { base.checkForEmpty(); }).bind(onPropertyChange, function() { base.checkForEmpty(); }); }; base.fadeOnFocus = function() { if (base.showing) { base.setOpacity(base.options.fadeOpacity); }; }; base.setOpacity = function(opacity) { base.$label.stop().animate({ opacity: opacity }, base.options.fadeDuration); base.showing = (opacity > 0.0); }; base.checkForEmpty = function(blur) { if (base.$field.val() == "") { base.prepForShow(); base.setOpacity(blur ? 1.0 : base.options.fadeOpacity); } else { base.setOpacity(0.0); }; }; base.prepForShow = function(e) { if (!base.showing) { base.$label.css({ opacity: 0.0 }).show(); base.$field.bind(keydown.infieldlabel, function(e) { base.hideOnChange(e); }); }; }; base.hideOnChange = function(e) { if ((e.keyCode == 16) || (e.keyCode == 9)) return; if (base.showing) { base.$label.hide(); base.showing = false; }; base.$field.unbind(keydown.infieldlabel); }; base.init(); }; $.InFieldLabels.defaultOptions = { fadeOpacity: 0.5, fadeDuration: 300, labelClass: infield }; $.fn.inFieldLabels = function(options) { return this.each(function() { var for_attr = $(this).attr(for); if (!for_attr) return; var $field = $("input#" + for_attr + "[type= ext]," + "input#" + for_attr + "[type=password]," + "input#" + for_attr + "[type= el]," + "input#" + for_attr + "[type=email]," + "textarea#" + for_attr); if ($field.length == 0) return; (new $.InFieldLabels(this, $field[0], options)); }); }; })(jQuery);$("#RegisterUserForm label").inFieldLabels();});html, body, h1, form, fieldset, input{margin: 0;padding: 0;border: none;}body{font-family: Helvetica, Arial, sans-serif;font-size: 12px;}#registration{color: #fff;background: #2d2d2d;background: -webkit-gradient( linear, left bottom, left top, color-stop(0, rgb(60,60,60)), color-stop(0.74, rgb(43,43,43)), color-stop(1, rgb(60,60,60)) );background: -moz-linear-gradient( center bottom, rgb(60,60,60) 0%, rgb(43,43,43) 74%, rgb(60,60,60) 100% );-moz-border-radius: 10px;-webkit-border-radius: 10px;border-radius: 10px;margin: 10px;width: 430px;}#registration a{color: #8c910b;text-shadow: 0px -1px 0px #000;}#registration fieldset{padding: 20px;}input.text{-webkit-border-radius: 15px;-moz-border-radius: 15px;border-radius: 15px;border: solid 1px #444;font-size: 14px;width: 90%;padding: 7px 8px 7px 30px;-moz-box-shadow: 0px 1px 0px #777;-webkit-box-shadow: 0px 1px 0px #777;background: #ddd url(img/inputSprite.jpg) no-repeat 4px 5px;background: url(images/inputSprite.jpg) no-repeat 4px 5px, -moz-linear-gradient( center bottom, rgb(225,225,225) 0%, rgb(215,215,215) 54%, rgb(173,173,173) 100% );background: url(images/inputSprite.jpg) no-repeat 4px 5px, -webkit-gradient( linear, left bottom, left top, color-stop(0, rgb(225,225,225)), color-stop(0.54, rgb(215,215,215)), color-stop(1, rgb(173,173,173)) );color: #333;text-shadow: 0px 1px 0px #FFF;}input#email{background-position: 4px 5px;background-position: 4px 5px, 0px 0px;}input#password{background-position: 4px -20px;background-position: 4px -20px, 0px 0px;}input#name{background-position: 4px -46px;background-position: 4px -46px, 0px 0px;}input#tel{background-position: 4px -76px;background-position: 4px -76px, 0px 0px;}#registration h2{color: #fff;text-shadow: 0px -1px 0px #000;border-bottom: solid #181818 1px;-moz-box-shadow: 0px 1px 0px #3a3a3a;text-align: center;padding: 18px;margin: 0px;font-weight: normal;font-size: 24px;font-family: Lucida Grande, Helvetica, Arial, sans-serif;}#registerNew{width: 203px;height: 40px;border: none;text-indent: -9999px;background: url(images/createAccountButton.jpg) no-repeat;cursor: pointer;float: right;}#registerNew: hover{background-position: 0px -41px;}#registerNew: active{background-position: 0px -82px;}#registration p{position: relative;}fieldset label.infield{color: #333;text-shadow: 0px 1px 0px #fff;position: absolute;text-align: left;top: 3px !important;left: 35px !important;line-height: 29px;}

Create an Account

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。