Ziyaretçiniz belirli sayıda seçenek seçebilmesine izin verir
Yazar
Mesaj
yakan531
Moderatör
Mesaj Sayısı : 207 Kayıt tarihi : 16/11/09 Yaş : 28
Konu: Ziyaretçiniz belirli sayıda seçenek seçebilmesine izin verir Çarş. Şub. 10, 2010 3:59 pm
Kod:
<script LANGUAGE="Javascript"> <!-- Original: Glenn Wang (brief( at )ix.netcom.com) --> <!-- Begin function countChoices(obj) { max = 2; // max. number allowed at a time
box1 = obj.form.box1.checked; // your checkboxes here box2 = obj.form.box2.checked; box3 = obj.form.box3.checked; // add more if necessary
count = (box1 ? 1 : 0) + (box2 ? 1 : 0) + (box3 ? 1 : 0); // If you have more checkboxes on your form // add more (box_ ? 1 : 0) 's separated by '+'
if (count > max) { alert("Dikkat! Sadece " + max + " bölüm seçebilirsiniz! \nBir bölümden onayı kaldırın ve seçmek istediğiniz diğer bölümü seçin."); obj.checked = false; } } // End --> </script>