![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 66 Pomógł: 0 Dołączył: 13.04.2007 Ostrzeżenie: (0%) ![]() ![]() |
Witam
Chciałbym zrobić coś takiego: mam pole checkbox / \ zaznaczam pokazują mi się 3 pola Nie zaznaczam tych pól nie ma input type Jak to zrobić ![]() Ten post edytował pandaci 17.04.2007, 21:00:10 |
|
|
![]() |
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 157 Pomógł: 0 Dołączył: 12.02.2007 Skąd: Zielona Góra Ostrzeżenie: (0%) ![]() ![]() |
dwie możliwości wykorzystać AJAX i PHP do "przeładowania" strony :]
Lub wykorzystać JavaScript i technologię DOM. Sprawdź funkcję GetElementById i innerHTML mam nadzieję że sie nie pomyliłem co do nazw bo klepię z palca a dawno nie używałem. PZDR -------------------- ------
Per Aspera Ad Astra |
|
|
![]()
Post
#3
|
|
![]() Grupa: Moderatorzy Postów: 2 921 Pomógł: 269 Dołączył: 11.08.2005 Skąd: 127.0.0.1 ![]() |
Nie potrzebujesz kombinować z DOM, a tym bardziej z AJAX-em. Po prostu ukrywasz odpowiednie pola przy pomocy CSS, a następnie podczas zmiany stanu checkbox-a, wyświetlasz lub ponownie ukrywasz.
Kod function show_hide(obj) { if(obj.checked) { document.getElementById('input1').style.display = "block"; document.getElementById('input2').style.display = "block"; document.getElementById('input3').style.display = "block"; } else { document.getElementById('input1').style.display = "none"; document.getElementById('input2').style.display = "none"; document.getElementById('input3').style.display = "none"; } } <input type="checkbox" onclick="show_hide(this);" /> <input type="text" id="input1" /> <input type="text" id="input2" /> <input type="text" id="input3" /> Pisane z palca, więc mógł gdzieś się wkraść błąd. Oczywiście zamiast kombinować z kilkoma elementami, możesz je umieścić w jednym div-ie i go ukrywać / wyświetlać. Ten post edytował batman 17.04.2007, 21:57:21 -------------------- I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features. |
|
|
![]()
Post
#4
|
|
Grupa: Zarejestrowani Postów: 66 Pomógł: 0 Dołączył: 13.04.2007 Ostrzeżenie: (0%) ![]() ![]() |
Dzieki wielkie MAM.
ALe jeden mały problem jak uruchamiam to się pokazują jak kliknę i odkliknę to ich nie ma jak zrobić żeby na początku też ich nie było ![]() |
|
|
![]()
Post
#5
|
|
![]() Grupa: Moderatorzy Postów: 2 921 Pomógł: 269 Dołączył: 11.08.2005 Skąd: 127.0.0.1 ![]() |
Kod <input type="text" id="input1" style="display:none;" />
<input type="text" id="input2" style="display:none;" /> <input type="text" id="input3" style="display:none;" /> -------------------- I would love to change the world, but they won't give me the source code.
My software never has bugs. It just develops random features. |
|
|
![]() ![]() |
![]() |
Aktualny czas: 21.08.2025 - 18:48 |