Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JS] Klasa i getElementById, getElementById wywolany w klasie zwraca undefined
comanderv
post
Post #1





Grupa: Zarejestrowani
Postów: 87
Pomógł: 1
Dołączył: 2.12.2008

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


witam,
piszę sobie małą klasę w której potrzebuje odwołać się do istniejącego elementu HTML, metoda getElementById nie skutkuje...
wygląda to mniej więcej tak:
  1. function klasa()
  2. {
  3. this.x=parseInt(Math.random()*300);
  4. this.y=parseInt(Math.random()*100);
  5.  
  6. //pare innych pierdół
  7.  
  8. var dzieci = document.getElementById('div2').children;
  9. this.d = dzieci.length;
  10. }
  11.  
  12. //wywolanie alert(this.d) drukuje mi 'undefined'


w pisaniu obiektowym a już tym bardziej w JSie jestem dość raczkujący, prosiłbym o pomoc (IMG:style_emoticons/default/smile.gif)

Ten post edytował comanderv 22.02.2011, 11:37:59
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
comanderv
post
Post #2





Grupa: Zarejestrowani
Postów: 87
Pomógł: 1
Dołączył: 2.12.2008

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


o Boże... moja spostrzegawczość... no tak (IMG:style_emoticons/default/sleep.gif)
pisałem że jestem raczkujący ale nie aż tak (IMG:style_emoticons/default/sleep.gif)
to teraz sam siebie zadziwiłem...

Dzięki za poświęcony czas na moją głupotę heh ...ale wstyd (IMG:style_emoticons/default/haha.gif)

edit: licznik swietny, eliminuje moje wylawianie childrensów (IMG:style_emoticons/default/smile.gif) dziekuje (IMG:style_emoticons/default/smile.gif)

Ten post edytował comanderv 22.02.2011, 12:04:01
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: 12.10.2025 - 22:51