张桐

修改申请试用页面--申请按钮

@@ -75,3 +75,64 @@ html,body{ @@ -75,3 +75,64 @@ html,body{
75 .submit_trail:hover { 75 .submit_trail:hover {
76 background: #00b960; 76 background: #00b960;
77 } 77 }
  78 +
  79 +.tip-yellowsimple {
  80 + z-index:1000;
  81 + text-align:left;
  82 + border:1px solid #c7bf93;
  83 + border-radius:4px;
  84 + -moz-border-radius:4px;
  85 + -webkit-border-radius:4px;
  86 + padding:6px 8px;
  87 + min-width:50px;
  88 + max-width:300px;
  89 + color:#000;
  90 + background-color:#fff9c9;
  91 + /**
  92 + * - If you set a background-image, border/padding/background-color will be ingnored.
  93 + * You can set any padding to .tip-inner instead if you need.
  94 + * - If you want a tiled background-image and border/padding for the tip,
  95 + * set the background-image to .tip-inner instead.
  96 + */
  97 +}
  98 +.tip-yellowsimple .tip-inner {
  99 + font:12px/16px arial,helvetica,sans-serif;
  100 +}
  101 +
  102 +/* Configure an arrow image - the script will automatically position it on the correct side of the tip */
  103 +.tip-yellowsimple .tip-arrow-top {
  104 + margin-top:-6px;
  105 + margin-left:-5px; /* approx. half the width to center it */
  106 + top:0;
  107 + left:50%;
  108 + width:9px;
  109 + height:6px;
  110 +
  111 +}
  112 +.tip-yellowsimple .tip-arrow-right {
  113 + margin-top:-4px; /* approx. half the height to center it */
  114 + margin-left:0;
  115 + top:50%;
  116 + left:100%;
  117 + width:6px;
  118 + height:9px;
  119 +
  120 +}
  121 +.tip-yellowsimple .tip-arrow-bottom {
  122 + margin-top:0;
  123 + margin-left:-5px; /* approx. half the width to center it */
  124 + top:100%;
  125 + left:50%;
  126 + width:9px;
  127 + height:6px;
  128 +
  129 +}
  130 +.tip-yellowsimple .tip-arrow-left {
  131 + margin-top:-4px; /* approx. half the height to center it */
  132 + margin-left:-6px;
  133 + top:50%;
  134 + left:0;
  135 + width:6px;
  136 + height:9px;
  137 +
  138 +}
@@ -163,4 +163,6 @@ @@ -163,4 +163,6 @@
163 } 163 }
164 164
165 165
  166 +
  167 +
166 }(); 168 }();
此 diff 太大无法显示。
  1 +/*
  2 + * Poshy Tip jQuery plugin v1.2
  3 + * http://vadikom.com/tools/poshy-tip-jquery-plugin-for-stylish-tooltips/
  4 + * Copyright 2010-2013, Vasil Dinkov, http://vadikom.com/
  5 + */
  6 +
  7 +(function(e){var a=[],d=/^url\(["']?([^"'\)]*)["']?\);?$/i,c=/\.png$/i,b=!!window.createPopup&&document.documentElement.currentStyle.minWidth=="undefined";function f(){e.each(a,function(){this.refresh(true)})}e(window).resize(f);e.Poshytip=function(h,g){this.$elm=e(h);this.opts=e.extend({},e.fn.poshytip.defaults,g);this.$tip=e(['<div class="',this.opts.className,'">','<div class="tip-inner tip-bg-image"></div>','<div class="tip-arrow tip-arrow-top tip-arrow-right tip-arrow-bottom tip-arrow-left"></div>',"</div>"].join("")).appendTo(document.body);this.$arrow=this.$tip.find("div.tip-arrow");this.$inner=this.$tip.find("div.tip-inner");this.disabled=false;this.content=null;this.init()};e.Poshytip.prototype={init:function(){a.push(this);var g=this.$elm.attr("title");this.$elm.data("title.poshytip",g!==undefined?g:null).data("poshytip",this);if(this.opts.showOn!="none"){this.$elm.bind({"mouseenter.poshytip":e.proxy(this.mouseenter,this),"mouseleave.poshytip":e.proxy(this.mouseleave,this)});switch(this.opts.showOn){case"hover":if(this.opts.alignTo=="cursor"){this.$elm.bind("mousemove.poshytip",e.proxy(this.mousemove,this))}if(this.opts.allowTipHover){this.$tip.hover(e.proxy(this.clearTimeouts,this),e.proxy(this.mouseleave,this))}break;case"focus":this.$elm.bind({"focus.poshytip":e.proxy(this.showDelayed,this),"blur.poshytip":e.proxy(this.hideDelayed,this)});break}}},mouseenter:function(g){if(this.disabled){return true}this.$elm.attr("title","");if(this.opts.showOn=="focus"){return true}this.showDelayed()},mouseleave:function(g){if(this.disabled||this.asyncAnimating&&(this.$tip[0]===g.relatedTarget||jQuery.contains(this.$tip[0],g.relatedTarget))){return true}if(!this.$tip.data("active")){var h=this.$elm.data("title.poshytip");if(h!==null){this.$elm.attr("title",h)}}if(this.opts.showOn=="focus"){return true}this.hideDelayed()},mousemove:function(g){if(this.disabled){return true}this.eventX=g.pageX;this.eventY=g.pageY;if(this.opts.followCursor&&this.$tip.data("active")){this.calcPos();this.$tip.css({left:this.pos.l,top:this.pos.t});if(this.pos.arrow){this.$arrow[0].className="tip-arrow tip-arrow-"+this.pos.arrow}}},show:function(){if(this.disabled||this.$tip.data("active")){return}this.reset();this.update();if(!this.content){return}this.display();if(this.opts.timeOnScreen){this.hideDelayed(this.opts.timeOnScreen)}},showDelayed:function(g){this.clearTimeouts();this.showTimeout=setTimeout(e.proxy(this.show,this),typeof g=="number"?g:this.opts.showTimeout)},hide:function(){if(this.disabled||!this.$tip.data("active")){return}this.display(true)},hideDelayed:function(g){this.clearTimeouts();this.hideTimeout=setTimeout(e.proxy(this.hide,this),typeof g=="number"?g:this.opts.hideTimeout)},reset:function(){this.$tip.queue([]).detach().css("visibility","hidden").data("active",false);this.$inner.find("*").poshytip("hide");if(this.opts.fade){this.$tip.css("opacity",this.opacity)}this.$arrow[0].className="tip-arrow tip-arrow-top tip-arrow-right tip-arrow-bottom tip-arrow-left";this.asyncAnimating=false},update:function(j,k){if(this.disabled){return}var i=j!==undefined;if(i){if(!k){this.opts.content=j}if(!this.$tip.data("active")){return}}else{j=this.opts.content}var h=this,g=typeof j=="function"?j.call(this.$elm[0],function(l){h.update(l)}):j=="[title]"?this.$elm.data("title.poshytip"):j;if(this.content!==g){this.$inner.empty().append(g);this.content=g}this.refresh(i)},refresh:function(h){if(this.disabled){return}if(h){if(!this.$tip.data("active")){return}var k={left:this.$tip.css("left"),top:this.$tip.css("top")}}this.$tip.css({left:0,top:0}).appendTo(document.body);if(this.opacity===undefined){this.opacity=this.$tip.css("opacity")}var l=this.$tip.css("background-image").match(d),m=this.$arrow.css("background-image").match(d);if(l){var i=c.test(l[1]);if(b&&i){this.$tip.css("background-image","none");this.$inner.css({margin:0,border:0,padding:0});l=i=false}else{this.$tip.prepend('<table class="tip-table" border="0" cellpadding="0" cellspacing="0"><tr><td class="tip-top tip-bg-image" colspan="2"><span></span></td><td class="tip-right tip-bg-image" rowspan="2"><span></span></td></tr><tr><td class="tip-left tip-bg-image" rowspan="2"><span></span></td><td></td></tr><tr><td class="tip-bottom tip-bg-image" colspan="2"><span></span></td></tr></table>').css({border:0,padding:0,"background-image":"none","background-color":"transparent"}).find(".tip-bg-image").css("background-image",'url("'+l[1]+'")').end().find("td").eq(3).append(this.$inner)}if(i&&!e.support.opacity){this.opts.fade=false}}if(m&&!e.support.opacity){if(b&&c.test(m[1])){m=false;this.$arrow.css("background-image","none")}this.opts.fade=false}var o=this.$tip.find("> table.tip-table");if(b){this.$tip[0].style.width="";o.width("auto").find("td").eq(3).width("auto");var n=this.$tip.width(),j=parseInt(this.$tip.css("min-width")),g=parseInt(this.$tip.css("max-width"));if(!isNaN(j)&&n<j){n=j}else{if(!isNaN(g)&&n>g){n=g}}this.$tip.add(o).width(n).eq(0).find("td").eq(3).width("100%")}else{if(o[0]){o.width("auto").find("td").eq(3).width("auto").end().end().width(document.defaultView&&document.defaultView.getComputedStyle&&parseFloat(document.defaultView.getComputedStyle(this.$tip[0],null).width)||this.$tip.width()).find("td").eq(3).width("100%")}}this.tipOuterW=this.$tip.outerWidth();this.tipOuterH=this.$tip.outerHeight();this.calcPos();if(m&&this.pos.arrow){this.$arrow[0].className="tip-arrow tip-arrow-"+this.pos.arrow;this.$arrow.css("visibility","inherit")}if(h&&this.opts.refreshAniDuration){this.asyncAnimating=true;var p=this;this.$tip.css(k).animate({left:this.pos.l,top:this.pos.t},this.opts.refreshAniDuration,function(){p.asyncAnimating=false})}else{this.$tip.css({left:this.pos.l,top:this.pos.t})}},display:function(h){var i=this.$tip.data("active");if(i&&!h||!i&&h){return}this.$tip.stop();if((this.opts.slide&&this.pos.arrow||this.opts.fade)&&(h&&this.opts.hideAniDuration||!h&&this.opts.showAniDuration)){var n={},m={};if(this.opts.slide&&this.pos.arrow){var l,g;if(this.pos.arrow=="bottom"||this.pos.arrow=="top"){l="top";g="bottom"}else{l="left";g="right"}var k=parseInt(this.$tip.css(l));n[l]=k+(h?0:(this.pos.arrow==g?-this.opts.slideOffset:this.opts.slideOffset));m[l]=k+(h?(this.pos.arrow==g?this.opts.slideOffset:-this.opts.slideOffset):0)+"px"}if(this.opts.fade){n.opacity=h?this.$tip.css("opacity"):0;m.opacity=h?0:this.opacity}this.$tip.css(n).animate(m,this.opts[h?"hideAniDuration":"showAniDuration"])}h?this.$tip.queue(e.proxy(this.reset,this)):this.$tip.css("visibility","inherit");if(i){var j=this.$elm.data("title.poshytip");if(j!==null){this.$elm.attr("title",j)}}this.$tip.data("active",!i)},disable:function(){this.reset();this.disabled=true},enable:function(){this.disabled=false},destroy:function(){this.reset();this.$tip.remove();delete this.$tip;this.content=null;this.$elm.unbind(".poshytip").removeData("title.poshytip").removeData("poshytip");a.splice(e.inArray(this,a),1)},clearTimeouts:function(){if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}},calcPos:function(){var n={l:0,t:0,arrow:""},h=e(window),k={l:h.scrollLeft(),t:h.scrollTop(),w:h.width(),h:h.height()},p,j,m,i,q,g;if(this.opts.alignTo=="cursor"){p=j=m=this.eventX;i=q=g=this.eventY}else{var o=this.$elm.offset(),l={l:o.left,t:o.top,w:this.$elm.outerWidth(),h:this.$elm.outerHeight()};p=l.l+(this.opts.alignX!="inner-right"?0:l.w);j=p+Math.floor(l.w/2);m=p+(this.opts.alignX!="inner-left"?l.w:0);i=l.t+(this.opts.alignY!="inner-bottom"?0:l.h);q=i+Math.floor(l.h/2);g=i+(this.opts.alignY!="inner-top"?l.h:0)}switch(this.opts.alignX){case"right":case"inner-left":n.l=m+this.opts.offsetX;if(this.opts.keepInViewport&&n.l+this.tipOuterW>k.l+k.w){n.l=k.l+k.w-this.tipOuterW}if(this.opts.alignX=="right"||this.opts.alignY=="center"){n.arrow="left"}break;case"center":n.l=j-Math.floor(this.tipOuterW/2);if(this.opts.keepInViewport){if(n.l+this.tipOuterW>k.l+k.w){n.l=k.l+k.w-this.tipOuterW}else{if(n.l<k.l){n.l=k.l}}}break;default:n.l=p-this.tipOuterW-this.opts.offsetX;if(this.opts.keepInViewport&&n.l<k.l){n.l=k.l}if(this.opts.alignX=="left"||this.opts.alignY=="center"){n.arrow="right"}}switch(this.opts.alignY){case"bottom":case"inner-top":n.t=g+this.opts.offsetY;if(!n.arrow||this.opts.alignTo=="cursor"){n.arrow="top"}if(this.opts.keepInViewport&&n.t+this.tipOuterH>k.t+k.h){n.t=i-this.tipOuterH-this.opts.offsetY;if(n.arrow=="top"){n.arrow="bottom"}}break;case"center":n.t=q-Math.floor(this.tipOuterH/2);if(this.opts.keepInViewport){if(n.t+this.tipOuterH>k.t+k.h){n.t=k.t+k.h-this.tipOuterH}else{if(n.t<k.t){n.t=k.t}}}break;default:n.t=i-this.tipOuterH-this.opts.offsetY;if(!n.arrow||this.opts.alignTo=="cursor"){n.arrow="bottom"}if(this.opts.keepInViewport&&n.t<k.t){n.t=g+this.opts.offsetY;if(n.arrow=="bottom"){n.arrow="top"}}}this.pos=n}};e.fn.poshytip=function(h){if(typeof h=="string"){var g=arguments,l=h;Array.prototype.shift.call(g);if(l=="destroy"){this.die?this.die("mouseenter.poshytip").die("focus.poshytip"):e(document).undelegate(this.selector,"mouseenter.poshytip").undelegate(this.selector,"focus.poshytip")}return this.each(function(){var m=e(this).data("poshytip");if(m&&m[l]){m[l].apply(m,g)}})}var j=e.extend({},e.fn.poshytip.defaults,h);if(!e("#poshytip-css-"+j.className)[0]){e(['<style id="poshytip-css-',j.className,'" type="text/css">',"div.",j.className,"{visibility:hidden;position:absolute;top:0;left:0;}","div.",j.className," table.tip-table, div.",j.className," table.tip-table td{margin:0;font-family:inherit;font-size:inherit;font-weight:inherit;font-style:inherit;font-variant:inherit;vertical-align:middle;}","div.",j.className," td.tip-bg-image span{display:block;font:1px/1px sans-serif;height:",j.bgImageFrameSize,"px;width:",j.bgImageFrameSize,"px;overflow:hidden;}","div.",j.className," td.tip-right{background-position:100% 0;}","div.",j.className," td.tip-bottom{background-position:100% 100%;}","div.",j.className," td.tip-left{background-position:0 100%;}","div.",j.className," div.tip-inner{background-position:-",j.bgImageFrameSize,"px -",j.bgImageFrameSize,"px;}","div.",j.className," div.tip-arrow{visibility:hidden;position:absolute;overflow:hidden;font:1px/1px sans-serif;}","</style>"].join("")).appendTo("head")}if(j.liveEvents&&j.showOn!="none"){var i,k=e.extend({},j,{liveEvents:false});switch(j.showOn){case"hover":i=function(){var m=e(this);if(!m.data("poshytip")){m.poshytip(k).poshytip("mouseenter")}};this.live?this.live("mouseenter.poshytip",i):e(document).delegate(this.selector,"mouseenter.poshytip",i);break;case"focus":i=function(){var m=e(this);if(!m.data("poshytip")){m.poshytip(k).poshytip("showDelayed")}};this.live?this.live("focus.poshytip",i):e(document).delegate(this.selector,"focus.poshytip",i);break}return this}return this.each(function(){new e.Poshytip(this,j)})};e.fn.poshytip.defaults={content:"[title]",className:"tip-yellow",bgImageFrameSize:10,showTimeout:500,hideTimeout:100,timeOnScreen:0,showOn:"hover",liveEvents:false,alignTo:"cursor",alignX:"right",alignY:"top",offsetX:-22,offsetY:18,keepInViewport:true,allowTipHover:true,followCursor:false,fade:true,slide:true,slideOffset:8,showAniDuration:300,hideAniDuration:300,refreshAniDuration:200}})(jQuery);
  1 +/*
  2 + * 常用的验证集合
  3 + * useage:if(validate.isemail(email)){...}else{....}
  4 + * last update 2015-07-29
  5 + */
  6 +String.prototype.trim = function(){
  7 + return this.replace(/(^\s*)|(\s*$)/g, "");
  8 +}
  9 +String.prototype.ltrim = function(){
  10 + return this.replace(/(^\s*)/g, "");
  11 +}
  12 +String.prototype.rtrim = function(){
  13 + return this.replace(/(\s*$)/g, "");
  14 +}
  15 +var validate = {
  16 + //是否电话号码
  17 + isphone: function (value) {
  18 + var patrn = /^((\+?86)|(\(\+86\)))?\d{3,4}-\d{7,8}(-\d{3,4})?$/
  19 + if (!patrn.exec(value)) return false
  20 + return true
  21 + },
  22 + //是否手机号码
  23 + iscellphone: function (value) {
  24 + var validateReg = /^((\+?86)|(\(\+86\)))?1\d{10}$/;
  25 + return validateReg.test(value);
  26 + },
  27 + //是否邮箱
  28 + isemail: function(value){
  29 + var emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
  30 + return emailRegex.test(value);
  31 + },
  32 + //是否为空
  33 + isempty: function(value){
  34 + if(value.length == 0) return true
  35 + return false;
  36 + },
  37 + //是否为18位身份证号码
  38 + id18: function (id) {
  39 + if(! /\d{17}[\dxX]/.test(id)) {
  40 + return false;
  41 + }
  42 + var modcmpl = function(m, i, n) { return (i + n - m % i) % i; },
  43 + f = function(v, i) { return v * (Math.pow(2, i-1) % 11); },
  44 + s = 0;
  45 + for(var i=0; i<17; i++) {
  46 + s += f(+id.charAt(i), 18-i);
  47 + }
  48 + var c0 = id.charAt(17),
  49 + c1 = modcmpl(s, 11, 1);
  50 + return c0-c1===0 || (c0.toLowerCase()==='x' && c1===10);
  51 + },
  52 + //是否为15位身份证号码,2013年1月1日起停止使用
  53 + id15:function (id) {
  54 + var pattern = /[1-9]\d{5}(\d{2})(\d{2})(\d{2})\d{3}/;
  55 + matches, y, m, d, date;
  56 + matches = id.match(pattern);
  57 + y = +('19' + matches[1]);
  58 + m = +matches[2];
  59 + d = +matches[3];
  60 + date = new Date(y, m-1, d);
  61 + return (date.getFullYear()===y && date.getMonth()===m-1 && date.getDate()===d);
  62 + },
  63 + //是否为IP地址
  64 + isip:function(ip){
  65 + var ipRegex = /^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$/i;
  66 + return ipRegex.test(ip);
  67 + },
  68 + //是否为URL地址
  69 + isurl:function(url){
  70 + var urlRegex = /^((http|https):\/\/(\w+:{0,1}\w*@)?(\S+)|)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
  71 + return urlRegex.test(url);
  72 + },
  73 + haschinese:function(value){
  74 + var patrn=/[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi;
  75 + if(!patrn.exec(value)){
  76 + return false;
  77 + }else{
  78 + return true;
  79 + }
  80 + }
  81 +
  82 +}
@@ -39,5 +39,89 @@ @@ -39,5 +39,89 @@
39 </div> 39 </div>
40 </div> 40 </div>
41 <script type="text/javascript" src="js/rem.js"></script> 41 <script type="text/javascript" src="js/rem.js"></script>
  42 +<script type="text/javascript" src="js/jquery.js"></script>
  43 +<script type="text/javascript" src="js/jquery.poshytip.min.js"></script>
  44 +<script type="text/javascript" src="js/validate.js"></script>
  45 +<script>
  46 + $(document).ready(function(){
  47 +
  48 + $('.submit_trail').click(function(){
  49 + var obj = $(this);
  50 + var user_name=$("input[name=user_name]").val();
  51 + var phone_number=$("input[name=phone_number]").val();
  52 + var email=$("input[name=email]").val();
  53 + var company=$("input[name=company]").val();
  54 + var telphone=$("input[name=telphone]").val();
  55 +// var clientip = returnCitySN["cip"];
  56 + if(validate.isempty(user_name)){
  57 + $("input[name=user_name]").poshytip({
  58 + className: 'tip-yellowsimple',
  59 + showOn: 'focus',
  60 + alignTo: 'target',
  61 + alignX: 'right',
  62 + alignY: 'center',
  63 + offsetX: 5,
  64 + showTimeout: 100
  65 + });
  66 + $("input[name=user_name]").focus();
  67 + return false;
  68 + }
  69 + if(!validate.iscellphone(phone_number)){
  70 + $("input[name=phone_number]").poshytip({
  71 + className: 'tip-yellowsimple',
  72 + showOn: 'focus',
  73 + alignTo: 'target',
  74 + alignX: 'right',
  75 + alignY: 'center',
  76 + offsetX: 5,
  77 + showTimeout: 100
  78 + });
  79 + $("input[name=phone_number]").focus();
  80 + return false;
  81 + }
  82 + if(!validate.isemail(email)){
  83 + $("input[name=email]").poshytip({
  84 + className: 'tip-yellowsimple',
  85 + showOn: 'focus',
  86 + alignTo: 'target',
  87 + alignX: 'right',
  88 + alignY: 'center',
  89 + offsetX: 5,
  90 + showTimeout: 100
  91 + });
  92 + $("input[name=email]").focus();
  93 + return false;
  94 + }
  95 +
  96 +
  97 + jQuery.support.cors = true;
  98 +
  99 + $.ajax({
  100 + url: "http://api.xuedianyun.com/sanmang/index.php/api/sendmail/sendmail",
  101 + type:'POST',
  102 + data:{email:email,user_name:user_name,phone_number:phone_number,company:company,telphone:telphone},
  103 + dataType: 'JSON',
  104 + success: function(res){
  105 + if(res.errcode == 0){
  106 + $('.info').show();
  107 + //alert("I am an alert box!!")
  108 + }else{
  109 + alert(res.msg);
  110 +
  111 + }
  112 + },complete:function(){
  113 + $(':input').val('');
  114 + $('.info').slideToggle(2000);
  115 + obj.empty().text("立即申请");
  116 + alert(res.msg);
  117 + }
  118 +
  119 + });
  120 +
  121 + })
  122 +
  123 + });
  124 +</script>
  125 +
42 </body> 126 </body>
43 </html> 127 </html>