JavaScript Computing constellation Zodiac Sample code

Source: Internet
Author: User

  This article describes the use of JavaScript computing constellation and the zodiac example, this can be used in the user registration display, we refer to the use of the bar

The code is as follows: <script language= "JavaScript" > <!--Begin function signs () {var start = 1901, birthyear = Document.zodiac . Year.value, Date=document.zodiac.date.value, Month=document.zodiac.month.selectedindex;   with (document.zodiac.sign) {  if (month = 1 && Date >=20 | | month = 2 && date <=18) { Value = "Aquarius";} if (month = = 1 && date >) {value = "Huh?";} if (month = 2 && Date >=19 | | month = 3 && Date <=20 {value = "Pisces";} if (month = = 2 && date >) {value = "Say what?";} if (month = 3 && da Te >=21 | | month = = 4 && Date <=19 {value = "Aries";} if (month = = 3 && date >) {value = OK.  whatever. ";} if (month = = 4 && Date >=20 | | month = 5 && date <=20) {value = "Taurus";} if (month = 4 && D Ate >) {value = "I ' m soooo sorry!";} if (month = 5 && Date >=21 | | month = 6 && date <=21) { Value = "Gemini";} if (Month = = 5 && date > {value = "umm ... no.";} if (month = 6 && Date >=22 | | month = 7 && Date <=22 {value = "cancer";} if (month = = 6 && date >) {value = "Sorry.";} if (month = 7 && date >=23 | | month = = 8 && Date <=22 {value = "Leo";} if (month = = 7 && date >) {value = "excuse me?";} if (M Onth = = 8 && Date >=23 | | month = = 9 && Date <=22 {value = "Virgo";} if (month = = 8 && date >) {value = Yeah. Right. ";} if (month = = 9 && Date >=23 | | | month = && Date <=22) {value = "Libra";} if (month = 9 && Date > {value = ' Try Again. '} if (month = && Date >=23 | | month = one && date <=21) {val UE = "Scorpio";} if (month = && date >) {value = "Forget it!";} if (month = = && Date >=22 | | month = = &A mp;& Date <=21 {value = "Sagittarius";} if (month = && date >) {value= "Invalid Date";} if (month = && Date >=22 | | month = = 1 && date <=19) {value = "Capricorn";} if (month = = && Date >) {value = ' No way! ';}} x = (start-birthyear)% with (document.zodiac.csign) {if (x = = 1 | | x = = -11) {value = "mouse";} if (x = = 0) {value = "ox" ";} if (x = = One | | x = = 1) {value = "Tiger";} if (x = = | | | x = = 2) {value = "rabbit";} if (x = = 9 | | x = = 3)  {value = "Dragon"; } if (x = = 8 | | | x = = 4)  {value = "Snake";} if (x = = 7 | | x = = 5)  {value = "Horse";} if (x = = 6 | | x = = = 6)  {val UE = "Sheep";} if (x = = 5 | | | x = = -7)  {value = "Monkey";} if (x = = 4 | | | x = = -8)  {value = "Chicken";} if (x = = 3 | | x = = -9)  {val UE = "Dog";} if (x = = 2 | | | x = = -10)  {value = "Pig";}    }}// end--> </script> <form name= "Zodiac" & Gt <center> <table bgcolor= "#eeaa00" border= "2" bordercolor= "#000000" rules= "None" cellspacing= "0" cellpadding= "4" >     <tr><td><b><i> Year of birth</i></b></td>     <td><div align= "right" ><input type= "text" size= "Ten" name = "Year" value= "Born" onclick=value= "" ></div></td>     <td><!--This empty the field is Just for appearance--></td>     <tr><td><b><i> birth month </i></b> </td>     <td><div align= "right" > <select name= "Month" > <option value= "x" > Please select a month </option> <option value= "1" > January </option><option value= "2" > February </option>< Option value= "3" > March </option> <option value= "4" > April </option><option value= "5" > May </ Option><option value= "6" > June </option> <option value= "7" > July </option><option value= "8" > August </option><option value= "9" > September </option> <option value= "Ten" > October </option>< Option value= "One" > November </option> <option value= "" > December </option></select></div></td>     <td><!--This empty the field is just for appearance--></td></tr >     <tr><td><b><i> day </i></b></td>     <div align= "right" ><input type= "text" name= "date" value= "Day" size= "3" onclick=value= "" ></td>   & nbsp <td><input type= "button" value= "Calculate" onclick= "signs ()" ></div></td></tr>     <tr><td><b><i> constellation:</i></b></td>     <td><div Align= "right" ><input type= "text" name= "sign" size= "value=" "align=" right "></div></td></ tr>     <td><!--This empty field are just for appearance--></td></tr>     &L t;tr><td><b><i> Zodiac:</i></b></td>     <td><div align= " Right "><input type=" text "name=" csign "size=" "></div></t"d>     <td><!--This empty field are just for appearance--></td></tr>   </TABL E> </center> </form>    
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.