Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript] Zaznaczanie kontrolek
island
post
Post #1





Grupa: Zarejestrowani
Postów: 67
Pomógł: 1
Dołączył: 7.09.2008

Ostrzeżenie: (0%)
-----


Czy jest możliwość zaznaczenia wszystkich checkboxów w obrębie jednego div'a.
Kombinuje z czymś takim , ale nie działa

Kod
document.getElementById(div_name).getElementsByTagName('checkbox').checked = true;


Ten post edytował island 21.01.2009, 10:00:52
Powód edycji: bbcode
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
island
post
Post #2





Grupa: Zarejestrowani
Postów: 67
Pomógł: 1
Dołączył: 7.09.2008

Ostrzeżenie: (0%)
-----


Mogę zaznaczyć wszystkie kontrolki w całym formularzu, ale nie mogę zaznaczyć ich w obrębie jednego diva!!
Proszę o wskazanie błędu - oto kod

Kod
var all;
    all = document.getElementById(div_name).getElementsByTagName('input').length +  document.getElementById(div_name).getElementsByTagName('checkbox').length;
    
    for (i=0; i<all; i++)
    {
      document.getElementById(id_group).elements[i].checked = true;
    }
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 11.10.2025 - 13:11