Home  >  Article  >  Web Front-end  >  js code to automatically obtain zodiac signs based on date of birth_javascript skills

js code to automatically obtain zodiac signs based on date of birth_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:22:44963browse

I'm helpless~ I just didn't study hard when I was studying~ When I looked at JavaScript, one head suddenly turned into two. . . . . . . .
Fortunately, the Internet provides a very good database~ After reading it, and then making some changes myself, I can basically complete the task~ Write down an archive for future use

Copy code The code is as follows:

function xingzuo() {
var start = 1901, date=document.getElementById("txtDay") .value, month=document.getElementById("txtMonth").value;;
with (document.getElementById("txtXZ")){
if (month == 1 && date >=20 || month == 2 && date <=18) {value = "Aquarius";}
if (month == 1 && date > 31) {value = "Huh?";}
if (month = = 2 && date >=19 || month == 3 && date <=20) {value = "Pisces";}
if (month == 2 && date > 29) {value = "Say what ?";}
if (month == 3 && date >=21 || month == 4 && date <=19) {value = "Aries";}
if (month == 3 && date > 31) {value = "OK. Whatever.";}
if (month == 4 && date >=20 || month == 5 && date <=20) {value = "Taurus" ;}
if (month == 4 && date > 30) {value = "I'm soooo sorry!";}
if (month == 5 && date >=21 || month == 6 && date <=21) {value = "Gemini";}
if (month == 5 && date > 31) {value = "Umm ... no.";}
if (month == 6 && date >=22 || month == 7 && date <=22) {value = "Cancer";}
if (month == 6 && date > 30) {value = "Sorry .";}
if (month == 7 && date >=23 || month == 8 && date <=22) {value = "Leo";}
if (month == 7 && date > 31) {value = "Excuse me?";}
if (month == 8 && date >=23 || month == 9 && date <=22) {value = "Virgo"; }
if (month == 8 && date > 31) {value = "Yeah. Right.";}
if (month == 9 && date >=23 || month == 10 && date <=22) {value = "Libra";}
if (month == 9 && date > 30) {value = "Try Again.";}
if (month == 10 && date > ;=23 || month == 11 && date <=21) {value = "Scorpio";}
if (month == 10 && date > 31) {value = "Forget it!";}
if (month == 11 && date >=22 || month == 12 && date <=21) {value = "Sagittarius";}
if (month == 11 && date > 30) {value = "Invalid Date";}
if (month == 12 && date >=22 || month == 1 && date <=19) {value = "Capricorn";}
if ( month == 12 && date > 31) {value = "No way!";}
}
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn