![]() |
![]() |
![]()
Post
#1
|
|
![]() Grupa: Zarejestrowani Postów: 399 Pomógł: 7 Dołączył: 11.06.2007 Skąd: Poznan Ostrzeżenie: (20%) ![]() ![]() |
Witam
Mam takie coś co mi sprawdza formularz i nie pozwala iść dalej a błądy wypisuje na stronie Prawie wszystko działą dobrze na LINK Ale wypisuje mi tylko pierszy bład. A innych nie wypisuje, ale blokuje a ja chiałbym żeby też wypiswało Kod <script type="text/javascript">
window.onload = function() { document.forms['rejstracja'].onsubmit = valid; } function valid() { var pas2 = 'Wpisz hasło.'; var pas = 'Hasła się różnią.'; var nic = ''; var tk = 'Tokeny się różnią.'; var tk2 = 'Wpisz token.'; var log = 'Login jest już zajęty.'; var log2 = 'Wpisz login.'; if (document.getElementById('spr').innerHTML == nic) { document.getElementById('spr').style.color = 'red'; document.getElementById('spr').innerHTML="Wpisz login."; return false } else if (document.getElementById('spr').innerHTML == pas || pas2) { return false; } else if (document.rejstracja.akceptuje.checked == false) { document.getElementById('akct').style.color = 'red'; document.getElementById('akct').innerHTML="Musisz zaakceptowac regulamin."; return false;} else if (document.getElementById('pass').innerHTML == nic) { document.getElementById('pass').style.color = 'red'; document.getElementById('pass').innerHTML="Wpisz hasło."; return false }else if (document.getElementById('pass').innerHTML == pas || pas2) { return false; } else if (document.getElementById('tok').innerHTML == nic) { document.getElementById('tok').style.color = 'red'; document.getElementById('tok').innerHTML="Wpisz token."; return false } else if (document.getElementById('tok').innerHTML == tk || tk2) { return false; } else { document.rejstracja.submit(); } } </script> |
|
|
![]() |
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 472 Pomógł: 8 Dołączył: 14.03.2004 Skąd: Rzeszów Ostrzeżenie: (0%) ![]() ![]() |
jak dla mnie to namodzone...
jak chcesz sprawdzić wartość pola formularza to nadaj ID formularzowi a nie znacznikowi <td> i wczytuj za pomoca document.getElementById('spr').value
-------------------- I need TP for my bunghole!!!
Mój nowy przyjaciel - tytanowa płytka na stałe ------------------------------------------------------ AEGEE, kwiaciarnia rzeszów , notariusz rzeszów, zakład krawiecki rzeszów, paweł jakubowicz |
|
|
![]()
Post
#3
|
|
![]() Developer Grupa: Moderatorzy Postów: 3 045 Pomógł: 290 Dołączył: 20.01.2007 ![]() |
Nie używaj else if tylko same ify.
|
|
|
![]() ![]() |
![]() |
Aktualny czas: 22.08.2025 - 01:00 |