[代码] [JavaScript]代码

		function chkID(num17){
			var stard = "10X98765432"; //最后一位身份证的号码
			var first = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; //1-17系数
			var sum=0;
			for (var i=0,d=num17.length;i<d;i++){
				sum += num17[i] * first[i];
			}
			var result = sum % 11;
			var last = stard[result];
			return num17+last;
		}
		function createID(area,y,m,d,sex){
			var first14 = area+''+y+''+m+''+d;
			var last3 = rndNum(1,998);
			var c1 = last3 % 2;
			if(c1!=sex) last3+=1;
			last3 = (''+(1000+last3)).substr(1,3);
			var res = chkID(first14+last3);
			return res;
		}