首页 > 代码库 > JS 错误

JS 错误

突然发现自己写了一段多么可笑的代码

<script type="text/javascript">	
	var boo = false;
	function docheck(){
		var data_un = document.getElementById("un").value;
		var data_ps = document.getElementById("ps").value;
		var reg = /^\s*$/;
		var num = 0
		if(reg.test(data_un) ){
			document.getElementById("un_desc").innerHTML="亲,您的输入不能为空";
			return false;
		}else{
			num++;
			document.getElementById("un_desc").innerHTML="";
		} 

		if(reg.test(data_ps)){
			document.getElementById("ps_desc").innerHTML="亲,您的输入不能为空";
			return false;
		}else{
			num++;
			document.getElementById("ps_desc").innerHTML="";
		}	
	 	if(num == 2){
	 		$.ajax({
			    type: "POST",
			    url: "/admin/businessModule/shopRight.html?id={$lbs_data->id}&o="+Math.random(),
			    //data: "id=" + user + "&p=" + pass,
			    data: "username=" + data_un +"&key=checkUserName",
			    success: function(msg){
				    if(msg == "true"){
				    	document.shopRight.submit();
				    }else{
						$("#un_desc").text("账号已被使用");
				    }
			    },

			});
	 	}
	}
		
	  
</script>

  每隔一两个月,看看自己前面写的代码,也许有合不拢嘴的瞬间。