A simple JavaScript function that returns the zodiac sign according to day and month.
- Click to select it.
function zodiac(day, month){
 // returns the zodiac sign according to day and month ( https://coursesweb.net/ )
 var zodiac =['', 'Capricorn', 'Aquarius', 'Pisces', 'Aries', 'Taurus', 'Gemini', 'Cancer', 'Leo', 'Virgo', 'Libra', 'Scorpio', 'Sagittarius', 'Capricorn'];
 var last_day =['', 19, 18, 20, 20, 21, 21, 22, 22, 21, 22, 21, 20, 19];
 return (day > last_day[month]) ? zodiac[month*1 + 1] : zodiac[month];
}

var z_sign = zodiac(15, 10); // 15 - October

document.write(z_sign); // Libra

Example, displays zodiac sign according to selected day and month:

<h4 id='s_zodiac'>Here it will display the Zodiac sign</h4><form action='#' method='post'>
<p>Select the day and month, then click the button.</p>
 Day: <select id='s_days'><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option><option value='13'>13</option><option value='14'>14</option><option value='15'>15</option><option value='16'>16</option><option value='17'>17</option><option value='18'>18</option><option value='19'>19</option><option value='20'>20</option><option value='21'>21</option><option value='22'>22</option><option value='23'>23</option><option value='24'>24</option><option value='25'>25</option><option value='26'>26</option><option value='27'>27</option><option value='28'>28</option><option value='29'>29</option><option value='30'>30</option><option value='31'>31</option></select> - 
 Month: <select id='s_m'><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='10'>October</option><option value='11'>November</option><option value='12'>December</option></select>
 <input type='button' id='test_z' value='Zodiac sign' />
</form>

<script>
function zodiac(day, month){
 // returns the zodiac sign according to day and month ( https://coursesweb.net/ )
 var zodiac =['', 'Capricorn', 'Aquarius', 'Pisces', 'Aries', 'Taurus', 'Gemini', 'Cancer', 'Leo', 'Virgo', 'Libra', 'Scorpio', 'Sagittarius', 'Capricorn'];
 var last_day =['', 19, 18, 20, 20, 21, 21, 22, 22, 21, 22, 21, 20, 19];
 return (day > last_day[month]) ? zodiac[month*1 + 1] : zodiac[month];
}
document.getElementById('test_z').onclick = function(){
 document.getElementById('s_zodiac').innerHTML = zodiac(document.getElementById('s_days').value, document.getElementById('s_m').value);
}
</script>

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Which attribute can be used to add CSS styles directly in the HTML tag?
type style class
<div style="width: 80%; border: 3px solid #888888;">Content</div>
Which CSS transform method distorts the HTML element in a given angle (including its content)?
translate() scale() skew()
#some_id {
  transform: skew(20deg, 25deg);
  -ms-transform: skew(20deg, 25deg);   /* IE 9 */
  -webkit-transform: skew(20deg, 25deg);   /* Safari and Chrome */
}
Click on the function which converts a Date object to a string.
indexOf() toString() getDate()
var rightnow = new Date();
alert( rightnow.toString() );
Which function applies a callback function to the elements of the given array?
array_merge() array_search() array_map()
$arr = arra("abc", "<p>xyz</p>", "<em>PHP</em>");
// apply the strip_tags() function to delete HTML tags from each array item
$arr = array_map("strip_tags", $arr);
}
Zodiac Signs JavaScript code

Last accessed pages

  1. Register and show online users and visitors (33100)
  2. Remove / Get duplicate array values - Reset array keys in PHP (11077)
  3. innerHTML and outerHTML to Get and Replace HTML content (24761)
  4. SHA512 Encrypt hash in JavaScript (16120)
  5. DIV and SPAN (5054)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (244)
  2. Register and show online users and visitors (153)
  3. Read Excel file data in PHP - PhpExcelReader (144)
  4. PHP-MySQL free course, online tutorials PHP MySQL code (139)
  5. JavaScript Course - Free lessons (116)