function contains(arryj, obj) { var i = arryj.length; while (i--) { if (obj.indexOf(arryj[i])>0) { return true; } } return false; } function tj(id){ var username=$("#username").val(); var password=$("#password").val(); if(username==''){ alert('用户名不为空'); }else if(password==''){ alert('密码不为空'); } var zddl=$('input[name="zddl"]:checked').val(); var arryj = new Array('register','gengd_grxx', 'mmzh','shenq_ruz','login'); var u = document.referrer;//document.referrer; $aa=contains(arryj, u); $.post("index.php",{"login":1,"username":username,"password":password,"zddl":zddl},function(data){ //alert(data); if(data.stat==1){ parent.layer.msg(data.info,3,1,function(){ if($aa==true){ location.href="/tc_/gr_zhongx.html"; }else if(u==''){ location.href="/tc_/gr_zhongx.html"; }else{ location.reload(); } }); //$("#dl").html(data.info); }else{ parent.layer.msg(data.info,3,8); } },'json')/**/ /**/ }