show_userinfo.innerHTML="登录/注册会员";var myuserid = ''; $("#login-sub").live('click',function(){ $('#errmsg').hide(); var user=$("#logusername").val(); var pass=$("#logpassword").val(); var key=$("#key").val(); if(document.getElementById("keeplogin").checked==true){ var lifetime=315360000; } if(user==""){ $('#errmsg').show().html("用户名不能为空!"); $("#username").focus(); return false }; if(user=="输入用户名"){ $('#errmsg').show().html("用户名不能为空!"); $("#username").focus(); return false }; if(pass==""){ $('#errmsg').show().html("密码不能为空!"); $("#password").focus(); return false }; if(key==""){ $('#errmsg').show().html("验证码不能为空!"); $("#key").focus(); return false }; $.ajax({ type:"POST",url:"/e/member/ajaxlog/",dataType:"html",data:{ 'username':user,'password':pass,'key':key,enews:'login','lifetime':lifetime //提交字段 } ,beforeSend:function(){ $('#errmsg').show().html(' 正在登陆...') } ,success:function(data){ if(data=='failuserid'){ $('#errmsg').show().html('用户名错误!') } else if(data=='failpassword'){ $('#errmsg').show().html('密码错误!') } else if(data=='failcheck'){ $('#errmsg').show().html('你的账号还没有激活,重发激活邮件!') } else if(data=='98'){ $('#errmsg').show().html('验证码已过期,请点击图片刷新') } else if(data=='99'){ $('#errmsg').show().html('验证码填写错误') } else{ $("#errmsg").hide(); $('#show_userinfo').show().html(data); $("#ajaxlog_bg").fadeOut(0); $("#ajaxlogin").hide(); $("#loginpl").hide(); $('#shortinfo').html("
"); $("#sxqd,#sxgz,#sxdy,#my-follow,#my-rss").trigger("click"); } } }) }); function CheckReg(key,value){ if(value!=''){ var data = {},key=key; data['enews']='register'; data[key]=value; if(key=='repassword'){ var pass=$("#password").val(); data['password']=pass; } $.ajax({ type:"POST",url:"/e/member/ajaxlog/",dataType:"html",data:data ,beforeSend:function(){ $('.'+key).html('') } ,success:function(msg){ if(!msg){ $('.'+key).html('填写正确!'); checkpass(); }else{ $('.'+key).html(''+msg+''); checkpass('all'); return false; } } }); }else{ $('.'+key).html('不允许为空!'); } } function checkpass(all){ var user=$("#username").val(); var username=$(".username").html(); var pass=$(".password").html(); var pass2=$(".repassword").html(); var email=$(".email").html(); if(username==pass && pass2==email && pass==pass2 && document.getElementById("checkin").checked==true && username!='' && user!=''){ $(".sign-submit i").css({"display":"none"}); $('#checkreg').show().html(''); }else{ $(".sign-submit i").css({"display":"block"}); $('#checkreg').show(); if(all){ $('#checkreg').show().html('有必选项没填写正确!'); } } } (function($){ $.fn.drag = function(options){ var x, drag = this, isMove = false, defaults = { }; var options = $.extend(defaults, options); var html = '
'+ '
拖动滑块验证
'+ '
'; this.append(html); var handler = drag.find('.handler'); var drag_bg = drag.find('.drag_bg'); var text = drag.find('.drag_text'); var maxWidth = drag.width() - handler.width(); handler.mousedown(function(e){ isMove = true; x = e.pageX - parseInt(handler.css('left'), 10); }); $(document).mousemove(function(e){ var _x = e.pageX - x; if(isMove){ if(_x > 0 && _x <= maxWidth){ handler.css({'left': _x}); drag_bg.css({'width': _x}); }else if(_x > maxWidth){ dragOk(); } } }).mouseup(function(e){ isMove = false; var _x = e.pageX - x; if(_x < maxWidth){ handler.css({'left': 0}); drag_bg.css({'width': 0}); } }); function dragOk(){ handler.removeClass('handler_bg').addClass('handler_ok_bg'); text.text('验证通过'); drag.css({'color': '#fff'}); handler.unbind('mousedown'); $(document).unbind('mousemove'); $(document).unbind('mouseup'); $(".sign-submit .sign-submit-btn").css({"background":"#333"}); $(".sign-submit em").css({"display":"none"}); } }; $.fn.extend({ leanModal:function(options){ var defaults={ top:100,overlay:0.5,closeButton:null }; var overlay=$("
"); $("body").append(overlay); options=$.extend(defaults,options); return this.each(function(){ var o=options; $(this).click(function(e){ var modal_id=$(this).attr("href"); $("#ajaxlog_bg").click(function(){ close_modal(modal_id) }); $(o.closeButton).click(function(){ close_modal(modal_id) }); var modal_height=$(modal_id).outerHeight(); var modal_width=$(modal_id).outerWidth(); $("#ajaxlog_bg").fadeToggle().css({ opacity:0 }); $("#ajaxlog_bg").fadeTo(0,o.overlay); $(modal_id).fadeToggle().css({ "position":"fixed","opacity":0,"z-index":11000,"left":50+"%","margin-left":-(modal_width/2)+"px","top":o.top+"%" }); $(modal_id).fadeTo(0,1); e.preventDefault() }) }); function close_modal(modal_id){ $("#ajaxlog_bg").fadeOut(); $(modal_id).fadeOut() } } }); })(jQuery); /*登录框代码*/ document.writeln("
"); document.writeln(" "); document.writeln("
"); document.writeln(""); $('#drag').drag();//滑动验证 function AjaxReg(){ ajaxlog(); switchTag('tab','tab_box',2,2,'conxk1','conxk2'); } function switchTag(tag, content, k, n, stylea, styleb) { for (i = 1; i <= n; i++) { if (i == k) { document.getElementById(tag + i).className = stylea; document.getElementById(content + i).className = "block" } else { document.getElementById(tag + i).className = styleb; document.getElementById(content + i).className = "hidden" } } }; function ajaxlog() { document.getElementById('ajaxlog').click(); } $('#ajaxlog').leanModal({ top: 25, overlay: 0.2, closeButton: '.closelog' }) //弹出第三方登录框 var newWindow; function makeNewWindow(url) { if (!newWindow || newWindow.closed) { var width = 625; var height = 450; var left = parseInt((screen.availWidth/2) - (width/2));//屏幕居中 var top = parseInt((screen.availHeight/2) - (height/2)); var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top; newWindow = window.open(url, "subWind", windowFeatures); } else { newWindow.focus(); } }