Konu Başlığı: js - text alanı engelleme
View Single Post
Sponsorlu Bağlantılar
Zoque.Forum
Advertisement
Old 15.04.2004   #5 (permalink)
absconder
 
absconder's Avatar
 
Üyelik Tarihi: 09.12.2000
Yer: istanbul
Yaş: 30
Mesaj: 1,973
Re: js - text alanı engelleme

radio button için anlamsız olmaz mı? yada ben senaryoyu anlamadım hadi checkbox olsa neyse ama radiobutton bir defa check edildi mi (eğer benzer isimle bir radiobutton yoksa) uncheck edilmez, etmek için kendisi dışında bir olaya ihtiyaç duyar. aşağıdaki kodun yol göstereceğine eminim

Kod:
<script>
function disableIt(t) {
  t.readOnly = true;
 t.disabled = true;
}
function unDisableIt(t) {
  t.readOnly = false;
  t.disabled = false;
}
</script>
<form name="f1">
<input name="a1" id="a1" onkeyup="if (this.value.length >0) { disableIt(this.form.a2);} else {unDisableIt(this.form.a2);}">
<input name="a2" id="a2" onkeyup="if (this.value.length >0) { disableIt(this.form.a1);} else {unDisableIt(this.form.a1);}">
<input type="radio" name="r1" id="r1" value="test1" onclick="if (this.checked) { disableIt(this.form.r2);} else {unDisableIt(this.form.r2);}"> test1
<input type="radio" name="r2" id="r2" value="test2" onclick="if (this.checked) { disableIt(this.form.r1);} else {unDisableIt(this.form.r1);}"> test1
<input type="checkbox" name="c1" id="c1" value="test3" onclick="if (this.checked) { disableIt(this.form.c2);} else {unDisableIt(this.form.c2);}"> test3
<input type="checkbox" name="c2" id="c2" value="test4" onclick="if (this.checked) { disableIt(this.form.c1);} else {unDisableIt(this.form.c1);}"> test4
</form>
ha, eğer radiobutton yarıdımı ile textbox ları aktif/inaktif yapacaksan;

Kod:
<script>
function disableIt(t) {
  t.readOnly = true;
 t.disabled = true;
}
function unDisableIt(t) {
  t.readOnly = false;
  t.disabled = false;
}
</script>
<form name="f1">
<input type="text" name="a1" id="a1">
<input type="text" name="a2" id="a2">
<input type="radio" name="r1" id="r1" value="test1" onclick="if (this.checked) { disableIt(this.form.a1);unDisableIt(this.form.a2);}"> test1
<input type="radio" name="r1" id="r1" value="test2" onclick="if (this.checked) { disableIt(this.form.a2);unDisableIt(this.form.a1);}"> test2
</form>
__________________
"oturduğum mahallenin yolları çamurluydu, boyalı ayakkabı giysem bile, o yollardan geçtikten sonra çamurlanmamaları mümkün değildi. hayatım da böyle." yılmaz güney
http://www.sipidik.com

Mesaj absconder tarafından 15.04.2004 (16:13) yeniden düzenlendi.
absconder şu an çevrimdışı   Mesajdan alıntı yaparak yeni bir cevap ekleyin