Automatic Acquisition of Constellation javascript code based on Birthdate

Source: Internet
Author: User
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! ";}
}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.