Zoque.Forum
»
Uzun bir JS yi kısaltma, yeniden düzenleme
|
| ://www Web tasarımı ve internet ile ilgili olarak karşılaştığınız problemleri ve merak ettiklerinizi burada tartışabilirsiniz. |
![]() |
|
|
LinkBack | Seçenekler |
|
|
#1 (permalink) |
|
Mesaj: n/a
|
Uzun bir JS yi kısaltma, yeniden düzenleme
merhaba arkadaşlar...
ben şu şekilde bir JS yazdım fakat çok uzun. bunu for next döngüsü ile kısaltabilir miyiz? bir türülü yapamadim yaaa... ![]() teşekkürler... fornext ile... for (var ko = 0; ko < 7; ko++) { if (ko!==6){ zo=ko+1; } konune="konu" + zo; var konu = document.istekf.konune.checked; if (konu) { konuu=true; } } ama çalışmıyor. ' //////////////////////////////////////////////////////////////////// çalışan şekli : (eccük uzun) <script language="JavaScript"> <!-- // kods var vsayy; vsayy=0; if (document.istekf.v1.checked) { vsayy ++ } if (document.istekf.v2.checked) { vsayy ++ } if (document.istekf.v3.checked) { vsayy ++ } if (document.istekf.v4.checked) { vsayy ++ } if (document.istekf.v5.checked) { vsayy ++ } if (document.istekf.v6.checked) { vsayy ++ } if (document.istekf.v7.checked) { vsayy ++ } if (document.istekf.v8.checked) { vsayy ++ } if (document.istekf.v9.checked) { vsayy ++ } if (document.istekf.v10.checked) { vsayy ++ } if (document.istekf.v11.checked) { vsayy ++ } if (document.istekf.v12.checked) { vsayy ++ } if (document.istekf.v13.checked) { vsayy ++ } if (document.istekf.v14.checked) { vsayy ++ } if (document.istekf.v15.checked) { vsayy ++ } if (document.istekf.v16.checked) { vsayy ++ } if (document.istekf.v17.checked) { vsayy ++ } if (document.istekf.v18.checked) { vsayy ++ } if (document.istekf.v19.checked) { vsayy ++ } if (vsayy==0) { alert("En az bir değer işaretlemelisiniz."); return (false); } --> </script> |
|
|
|
#3 (permalink) |
|
Üyelik Tarihi: 02.06.2001
Yer: İstanbul
Yaş: 28
Mesaj: 279
|
bu sorunu Sunucu Tabanlı Prog. (server Side) bölümüne yazsan daha iyi olurdu.
Birde, bu forumda js bilene hiç rastlamadım. Js yerine ASP kullanmanı tavsiye edererim...
__________________
www.kasif.org |
|
|
|
|
|
#4 (permalink) | |
|
Üyelik Tarihi: 21.10.2000
Yer: Istanbul, Türkiye
Yaş: 28
Mesaj: 1,995
|
Alıntı:
JS = javacript, forumdaki birçok kişi bu konuda yorum yapabilecek düzeyde. ![]()
__________________
::: e? - Online Yaşam ve Tasarım Kültürü Sorunuz belki çoktan cevaplanmıştır? Faydalı: W3 - MACCAWS - WaSP |
|
|
|
|
|
|
#5 (permalink) |
|
Üyelik Tarihi: 02.06.2001
Yer: İstanbul
Yaş: 28
Mesaj: 279
|
evet jsp yazmam gerekirken js yazmışım. bir yanlışlık olmuş.
Bu forumda bu konuda (js) cok şey söyleyebilecek ve yapabilecek kişiler var. Fakat jsp konusunda aynı şeyi söyleyemem. ![]()
__________________
www.kasif.org |
|
|
|
|
|
#6 (permalink) |
|
Üyelik Tarihi: 25.08.2001
Yer: Antalya
Yaş: 27
Mesaj: 970
|
Aşağıdaki şekilde dener misin?
Kod:
var vsayy;
vsayy=0;
for(i=1;i<20;i++){
if (eval(document.istekf.v+i+.checked)) {
vsayy ++
}
}
if (vsayy==0) {
alert("En az bir değer işaretlemelisiniz.");
return (false);
}
__________________
Take me back to my boat on the river and I won't cry out any more |
|
|
|
Zoque'a hoşgeldiniz!