Limitli Seçme
Ziyaretçiniz belirli sayıda seçenek seçebilmesine izin verir.
ÖRNEK
<SCRIPT LANGUAGE="JavaScript"> <!-- Original: Glenn Wang (brief@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>
<center> <form> Lütfen sadece 2 bölüm seçiniz: <p> <input type=checkbox name=box1 onClick="countChoices(this)" value="ON">Bölüm 1 <p> <input type=checkbox name=box2 onClick="countChoices(this)" value="ON">Bölüm 2 <p> <input type=checkbox name=box3 onClick="countChoices(this)" value="ON">Bölüm 3 <p> </form> </center>
Copyright © 2002-2004 www.javascriptbankasi.com.tr.tc
Mail:javascriptbankasi@hotmail.com