p4F Posted May 6, 2008 Report Share Posted May 6, 2008 kā ar JS palīdzību var sataisīt ja ir aizpildīts platums_no (inputs) tad vajaga lai būtu arī aizpildīts arī platums_lidz vai otrādāk, un ja nav tad izlido alert("nav aizpildīts lauks"); vai tas vispār ir iespējams Link to comment Share on other sites More sharing options...
andrisp Posted May 6, 2008 Report Share Posted May 6, 2008 Ir iespējams. formas onsubmit piekabini klāt pārbaudi: if ((pirmais lauks nav tuksh un otrais lauks ir tuksh) VAI (pirmais lauks ir tuksh, bet otrais nav)) { alert(); } Link to comment Share on other sites More sharing options...
Delfins Posted May 6, 2008 Report Share Posted May 6, 2008 Tas tač XOR, īsāk. http://en.wikipedia.org/wiki/Exclusive_or Link to comment Share on other sites More sharing options...
p4F Posted May 7, 2008 Author Report Share Posted May 7, 2008 varbūt ir kam kods? Link to comment Share on other sites More sharing options...
andrisp Posted May 7, 2008 Report Share Posted May 7, 2008 p4f, ko tu tieši nesaproti ? Kā IF kontrukciju izmantot ? Link to comment Share on other sites More sharing options...
p4F Posted May 7, 2008 Author Report Share Posted May 7, 2008 nesaprotu kā ar js pārbaudīt vai 1 inputs aizspildīts vai 2. Link to comment Share on other sites More sharing options...
andrisp Posted May 7, 2008 Report Share Posted May 7, 2008 Bet mēs taču pateicām... Link to comment Share on other sites More sharing options...
indoom Posted May 7, 2008 Report Share Posted May 7, 2008 (edited) <form action="" method="post" onsubmit="if ((this.input1.value?1:0) ^ (this.input2.value?1:0)) { alert('nu gan'); return false; }"> <input type="text" name="input1" value="" /> <input type="text" name="input2" value="" /> <input type="submit" /> </form> EDIT: Ok, pielaboju ar XOR operatoru, ja jau tas tiek pieprasīts :] Edited May 7, 2008 by indoom Link to comment Share on other sites More sharing options...
Delfins Posted May 7, 2008 Report Share Posted May 7, 2008 XOR Javascriptā (te pat jau arī viena atbilde bija) http://www.howtocreate.co.uk/xor.html PS: atvainojos, nepaskatījos foruma sadaļu. Link to comment Share on other sites More sharing options...
Recommended Posts