This article mainly introduces the sample code for js to judge the Constellation Based on the date. If you need it, you can refer to it and hope to help you.
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 = "";}
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 = "";}
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! ";}
}
}