使用js通过月与日查出星座

HTML

身份证号:53352319870410XXXX

籍贯:云南

年龄:49岁

星座:天蝎座

服务类型:1

js


function getAstro(month,day){

  return "魔羯水瓶双鱼牡羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯".substr(m*2-(d<"102223444433".charAt(m-1)- -19)*2,2);

}

/* 身份信息 */
	var identityw = data.identity_card;
	var ident = identityw.substring(0,identityw.length-4);
	document.getElementById("identity").innerHTML = "身份证号:"+ident+"****";
	document.getElementById("yj").innerHTML = "籍贯:"+data.major_service_city;
	// document.getElementById("ss").innerHTML = "民族:汉族";
	document.getElementById("ssl").innerHTML = "年龄:"+data.age;
	var month = identityw.substring(10,12);
	var day = identityw.substring(12,14);
	var xxx =   getAstro(month,day);
	document.getElementById("xx").innerHTML = "星座:"+xxx;
	if(data.type == 1){
	document.getElementById("yy").innerHTML = "服务类型:月嫂";
	}else{
	document.getElementById("yy").innerHTML = "服务类型:育儿嫂";
	}

参考网址:http://www.php.cn/js-tutorial-343304.html

你可能感兴趣的:(js)