Recently this project needs to be registered when the user fill in the date of birth, and then automatically get the constellation, think of it as if it is too troublesome to use background code instead of JavaScript. Helpless ~ It's strange that I didn't do a good job at school ~ Looking at JavaScript, one header suddenly becomes two ........
Fortunately, the network provides a good database ~ After reading it, I changed it myself. You can basically complete the task ~ Write down an archive for future use
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! ";}
}
}