p4F Posted June 16, 2008 Report Share Posted June 16, 2008 Labdien! Varētu jūs iedot kautkādu keyword vai linku. Piem ievadot datus 3 laukos un uzspiežot uz Submit pogas tie dati rādas iekš <tr><td>Dats1</td><td>Dats2</td><td>Dats3</td><td>INPUT POGA DZĒST</td></tr> un tā piespiežot uz submit pogas pievienojas ... reizes(cik uzspieda), bet uzspiedot uz INPUT POGU DZĒST dzēšas tas <tr>. Domāju jūs sapratāt. Link to comment Share on other sites More sharing options...
Delfins Posted June 16, 2008 Report Share Posted June 16, 2008 nesapratām Link to comment Share on other sites More sharing options...
p4F Posted June 17, 2008 Author Report Share Posted June 17, 2008 Atradu. Link to comment Share on other sites More sharing options...
p4F Posted June 18, 2008 Author Report Share Posted June 18, 2008 hmm, man izvada nevis 1 bet 01 kas nepareizs ? <input type="hidden" name="cik" id="cik" value="0" /> var cik = document.getElementById('cik').value; document.getElementById('cik').value = cik + 1; Link to comment Share on other sites More sharing options...
andrisp Posted June 18, 2008 Report Share Posted June 18, 2008 JS viņus savieno kā stringus nevis saskaita kā skaitļus. Divi varianti: 1. cik*1 + 1 (tāds lētais variants) 2. parseInt(cik) + 1 (smukāks variants) Link to comment Share on other sites More sharing options...
p4F Posted June 18, 2008 Author Report Share Posted June 18, 2008 vēlviens ar kādu funkciju var saskaitīt cik ir <tr> iekš <table id="tID">? Link to comment Share on other sites More sharing options...
andrisp Posted June 18, 2008 Report Share Posted June 18, 2008 document.getElementById('tID').getElementsByTagName('tr').length (vai arī length(), neatceros). Link to comment Share on other sites More sharing options...
indoom Posted June 18, 2008 Report Share Posted June 18, 2008 document.getElementById('tlD').rows.length; Link to comment Share on other sites More sharing options...
Paulinjsh Posted June 18, 2008 Report Share Posted June 18, 2008 vispār man šķiet, ka pareizāk ir andrisp variants. Link to comment Share on other sites More sharing options...
indoom Posted June 19, 2008 Report Share Posted June 19, 2008 (edited) Vai varētu uzzināt kāpēc? Ņemot vērā, ka getElementsByTagName() uz IE un Operas darbojas daudz lēnāk par rows . It īpaši uz IE6. Edited June 19, 2008 by indoom Link to comment Share on other sites More sharing options...
Paulinjsh Posted June 19, 2008 Report Share Posted June 19, 2008 indoom tomēr taisnība. nezināju tādu .rows Link to comment Share on other sites More sharing options...
p4F Posted June 19, 2008 Author Report Share Posted June 19, 2008 (edited) un vēl jauns jautājums var kas = 1; var cena_kas = '"cena'+kas+'"'; var cena = document.getElementById(cena_kas).value; neizvelk no <input type="hidden" name="cena_1" id="cena_1" value="9.00" /> Edited June 19, 2008 by p4F Link to comment Share on other sites More sharing options...
bubu Posted June 19, 2008 Report Share Posted June 19, 2008 cena_1 vai cena1? Kautkādas pēdiņas līkas arī esi salicis. alert(cena_kas) paskaties. Tur jābūt cena_1 un nekam citam. Link to comment Share on other sites More sharing options...
Aleksejs Posted June 19, 2008 Report Share Posted June 19, 2008 Loģiski, tādēļ, ka: 1) Tu izmanto getElementById(kas), bet pēc loģikas būtu jāizmanto getElementById(cena_kas) 2) Pat, ja izmantotu 1), vienalga cena_kas tev pēc šī parauga ir vienāda ar "cena1", bet vajaga cena_1 -> var cena_kas = "cena_" + kas; Link to comment Share on other sites More sharing options...
p4F Posted June 19, 2008 Author Report Share Posted June 19, 2008 (edited) izvada "cena_1" iekš alert var kas = 1; var cena_kas = '"cena_'+kas+'"'; alert(cena_kas); var cena = document.getElementById(cena_kas).value; Edited June 19, 2008 by p4F Link to comment Share on other sites More sharing options...
Recommended Posts