1. Anasayfa
  2. Javascript

JavaScript Örnekleri – Burç Hesaplama, Burç Bulma

JavaScript Örnekleri – Burç Hesaplama, Burç Bulma
1

astroloji
Kullanıcının girmiş olduğu gün ay değerlerine göre hangi burçtan olduğunu bulan javascript kodları, program içerisinde gün ve ay değerleri if komutu ile kontrol edilerek burç değeri bulunuyor uygulamanın çalışan hali ve kodlarımız..:
[wp-js-fiddle url=”http://jsfiddle.net/BilisimOgretmeni/6Lspc164/1/” style=”width:100%; height:200px; border:solid #4173A0 1px;”]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>www.bilisimogretmeni.com</title>
<script language="javascript" type="text/javascript">
function burcbul() {
document.form1.gun.selectedIndex;
document.form1.ay.selectedIndex;
document.form1.burc.value;
if (document.form1.ay.selectedIndex == 1 && document.form1.gun.selectedIndex <= 19) { document.form1.burc.value = "Oğlak"; }
if (document.form1.ay.selectedIndex == 1 && document.form1.gun.selectedIndex >= 20) { document.form1.burc.value = "Kova"; }
if (document.form1.ay.selectedIndex == 2 && document.form1.gun.selectedIndex <= 18) { document.form1.burc.value = "Kova"; }
if (document.form1.ay.selectedIndex == 2 && document.form1.gun.selectedIndex >= 19) { document.form1.burc.value = "Balık"; }
if (document.form1.ay.selectedIndex == 3 && document.form1.gun.selectedIndex <= 20) { document.form1.burc.value = "Balık"; }
if (document.form1.ay.selectedIndex == 3 && document.form1.gun.selectedIndex >= 21) { document.form1.burc.value = "Koç"; }
if (document.form1.ay.selectedIndex == 4 && document.form1.gun.selectedIndex <= 20) { document.form1.burc.value = "Koç"; }
if (document.form1.ay.selectedIndex == 4 && document.form1.gun.selectedIndex >= 21) { document.form1.burc.value = "Boğa"; }
if (document.form1.ay.selectedIndex == 5 && document.form1.gun.selectedIndex <= 20) { document.form1.burc.value = "Boğa"; }
if (document.form1.ay.selectedIndex == 5 && document.form1.gun.selectedIndex >= 21) { document.form1.burc.value = "İkizler"; }
if (document.form1.ay.selectedIndex == 6 && document.form1.gun.selectedIndex <= 20) { document.form1.burc.value = "İkizler"; }
if (document.form1.ay.selectedIndex == 6 && document.form1.gun.selectedIndex >= 21) { document.form1.burc.value = "Yengeç"; }
if (document.form1.ay.selectedIndex == 7 && document.form1.gun.selectedIndex <= 21) { document.form1.burc.value = "Yengeç"; }
if (document.form1.ay.selectedIndex == 7 && document.form1.gun.selectedIndex >= 22) { document.form1.burc.value = "Aslan"; }
if (document.form1.ay.selectedIndex == 8 && document.form1.gun.selectedIndex <= 21) { document.form1.burc.value = "Aslan"; }
if (document.form1.ay.selectedIndex == 8 && document.form1.gun.selectedIndex >= 22) { document.form1.burc.value = "Başak"; } //www.bilisimogretmeni.com
if (document.form1.ay.selectedIndex == 9 && document.form1.gun.selectedIndex <= 21) { document.form1.burc.value = "Başak"; }
if (document.form1.ay.selectedIndex == 9 && document.form1.gun.selectedIndex >= 22) { document.form1.burc.value = "Terazi"; }
if (document.form1.ay.selectedIndex == 10 && document.form1.gun.selectedIndex <= 21) { document.form1.burc.value = "Terazi"; }
if (document.form1.ay.selectedIndex == 10 && document.form1.gun.selectedIndex >= 22) { document.form1.burc.value = "Akrep"; }
if (document.form1.ay.selectedIndex == 11 && document.form1.gun.selectedIndex <= 21) { document.form1.burc.value = "Akrep"; }
if (document.form1.ay.selectedIndex == 11 && document.form1.gun.selectedIndex >= 22) { document.form1.burc.value = "Yay"; }
if (document.form1.ay.selectedIndex == 12 && document.form1.gun.selectedIndex <= 20) { document.form1.burc.value = "Yay"; }
if (document.form1.ay.selectedIndex == 12 && document.form1.gun.selectedIndex >= 21) { document.form1.burc.value = "Oğlak"; }
if (document.form1.ay.selectedIndex == "x" || document.form1.gun.selectedIndex == "y") return;
}
function validate() {
if (document.form1.ay.selectedIndex == 2 && document.form1.gun.selectedIndex > 29) { alert("Şubat ayında en fazla 29 gün seçebilirsiniz"); return false; }
if (document.form1.ay.selectedIndex == 4 && document.form1.gun.selectedIndex == 31) { alert("Nisan ayında sadece 30 gün vardır."); return false; }
if (document.form1.ay.selectedIndex == 6 && document.form1.gun.selectedIndex == 31) { alert("Haziran ayında sadece 30 gün vardır."); return false; }
if (document.form1.ay.selectedIndex == 9 && document.form1.gun.selectedIndex == 31) { alert("Eylül ayında sadece 30 gün vardır."); return false; } //www.bilisimogretmeni.com
if (document.form1.ay.selectedIndex == 11 && document.form1.gun.selectedIndex == 31) { alert("Kasım ayında sadece 30 gün vardır."); return false; }
else {
return true;
}
}
</script>
</head>
<body>
<form name="form1">
<table border="0" bgcolor="c0c0c0" cellspacing="0" cellpadding="1">
<tr>
<td>
<font size="1" face="verdana, arial, helvetica, sans-serif"><b>&nbsp;Ay&nbsp;</b></font>
</td>
<td>
<font size="1" face="verdana, arial, helvetica, sans-serif"><b>&nbsp;Gün&nbsp;</b></font>
</td>
<td rowspan="2">
<font size="3" face="verdana, arial, helvetica, sans-serif"><b>&nbsp;&nbsp;<b>:</b>&nbsp;</b></font>
</td>
<td>
<font size="1" face="verdana, arial, helvetica, sans-serif"><b>&nbsp;Burç&nbsp;</b></font>
</td>
</tr>
<tr>
<td>
&nbsp;<select name="ay">
<option value="x" selected>&lt; Ay Seçin &gt;&nbsp;</option>
<option value="1">Ocak</option>
<option value="2">Şubat</option>
<option value="3">Mart</option>
<option value="4">Nisan</option>
<option value="5">Mayıs</option>
<option value="6">Haziran</option>
<option value="7">Temmuz</option>
<option value="8">Ağustos</option>
<option value="9">Eylül</option>
<option value="10">Ekim</option>
<option value="11">Kasım</option>
<option value="12">Aralık</option>
</select>
</td>
<td>
&nbsp;<select name="gun" onChange="validate()">
<option value="y" selected>&lt; Gün Seçin &gt;&nbsp;</option>
<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>
</td>
<td>
&nbsp;<input name="burc" size="12" value="??" />&nbsp;<input type="button" value="Burç Bul" onClick="burcbul()">
</td>
</tr>
</table>
</form>
</body>
</html>
Bu İçeriğe Tepkin Ne Oldu?
  • 1
    ba_ar_l_
    Başarılı
  • 0
    gayet_yi
    Gayet İyi
  • 1
    te_ekk_rler
    Teşekkürler
  • 2
    anlamad_m
    Anlamadım
  • 4
    yetersiz
    Yetersiz
İlginizi Çekebilir
Subscribe
Bildir
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Yorum
Inline Feedbacks
View all comments
Mine

Dışarıdan girilen 10 sayının içinde 5in katları olanları bulup büyükten küçüğe sıralaması. Soru bu hocam yardımcı olursanız..