$(document).ready(function() { $("#btn-submit").click(function(){ var username = $("#username").val() var email = $("#email").val(); var content = $("#content").val(); var code = $("#code").val(); if(! username || !email) { alert("请填写完正信息"); } else { if(! code) { alert("请填写验证码"); }else { $.post("/index/postmail", {username:username, email:email, content:content, code:code}, function(result){ if(result == 2){ $('#vcodeimg').click(); alert("验证码错误"); } if(result == 1){ $('#vcodeimg').click(); alert("提交失败"); } if(result == 0){ $("#username").val('') $("#email").val(''); $("#content").val(''); $("#code").val(''); alert("您的信息我们已收到,稍后会有工作人员与你联系"); } }, 'json'); } } }); /* var speed=40 var demo=document.getelementbyid("demo"); var demo2=document.getelementbyid("demo2"); var demo1=document.getelementbyid("demo1"); demo2.innerhtml=demo1.innerhtml function marquee(){ if(demo2.offsettop-demo.scrolltop<=0) demo.scrolltop-=demo1.offsetheight else{ demo.scrolltop++ } } var mymar=setinterval(marquee,speed) demo.onmouseover=function() {clearinterval(mymar)} demo.onmouseout=function() { mymar=setinterval(marquee,speed); } */ /*文章列表刷新*/ /*var dynamic=document.getelementbyid('demo1'); var anews_li=dynamic.children; dynamic.innerhtml+=dynamic.innerhtml; var h=dynamic.offsetheight/2; var length=anews_li.length/2; var count=0; var timer2=null; function auto(){ if(count==length){ count=0; dynamic.style.top=0; }; count++; move(dynamic,{top:-count*anews_li[0].offsetheight},{time:700}); //alert(count) }; */ /*运动函数2*/ /*function getstyle(obj, name) { return obj.currentstyle?obj.currentstyle[name]:getcomputedstyle(obj, false)[name]; } function move(obj, json, options) { options=options||{}; options.type=options.type||'buffer'; options.time=options.time||700; var count=parseint(options.time/30); var n=0; var start={}; var dis={}; for(var name in json) { if(name=='opacity') { start[name]=math.round(parsefloat(getstyle(obj, name))*100); } else { start[name]=parseint(getstyle(obj, name)); } dis[name]=json[name]-start[name]; } clearinterval(obj.timer); obj.timer=setinterval(function (){ n++; for(var name in json) { switch(options.type) { case 'linear': var cur=start[name]+dis[name]*n/count; break; case 'buffer': var a=1-n/count; var cur=start[name]+dis[name]*(1-a*a*a); break; case 'ease-in': var a=n/count; var cur=start[name]+dis[name]*(a*a*a); break; } if(name=='opacity') { obj.style.filter='alpha(opacity:'+cur+')'; obj.style.opacity=cur/100; } else { obj.style[name]=cur+'px'; } } if(n==count) { clearinterval(obj.timer); options.end && options.end(); } }, 30); }; timer2=setinterval(auto,2000);*/ });