Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> getElementById - błąd w IE
konstruktor
post
Post #1





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 22.03.2005

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


Hej, mam pytanie:
Dlaczego IE traktuje to jako błąd:
Kod
function disable(idek1) {
  document.getElementById(idek1).disabled=true;
}

IE jako błąd podaje:
Cytat
'document.getElementById(...)' jest pusty lub nie jest obiektem

Jak to poprawic?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




1)a co to jest to idek?
2) pokaż input, który ma id takie jak ten idek
Go to the top of the page
+Quote Post
konstruktor
post
Post #3





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 22.03.2005

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


idek1 to po prostu parametr
a funkcje disable wywoluje tak:
Kod
<INPUT TYPE="button" NAME="speed" ID="speed" VALUE="speed up" style="width: 68px;" onclick = "disable('speed'); operacja();">
Go to the top of the page
+Quote Post
nospor
post
Post #4





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




że parametr to sie domyslilem (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)
wpisalem:
  1. <script language="JavaScript">
  2. function disable(idek1) {
  3. document.getElementById(idek1).disabled=true;
  4. }</script>
  5.  
  6. <INPUT TYPE="button" NAME="speed" ID="speed" VALUE="speed up" style="width: 68px;" onclick = "disable('speed');">
i dziala i pod IE, i pod operą. Może masz jakieś stare IE. A może zamiast duży liter ID dawaj male id

a może to w funkcji opearcja() ten błąd wywala?
Go to the top of the page
+Quote Post
konstruktor
post
Post #5





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 22.03.2005

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


nospor dzieki za zainteresowanie i szybkie odpowiedzi
U mnie to tez działa tylko, IE mowi ze jest błąd (ikonka z wykrzyknikiem w lewym dolnym rogu okna), FF nic nie zgłasza
Edit: wkleilem do nowego pliku tylko ten fragment co Ty i nic nie wywaliło, hmmm...

Ten post edytował konstruktor 23.08.2005, 15:03:43
Go to the top of the page
+Quote Post
nospor
post
Post #6





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Nie hmmm, tylko coś u siebie masz nie tak. Może to ta funkcja operacja(). Ja jej nie mam, wiec jej nie wywolywalem
Go to the top of the page
+Quote Post
konstruktor
post
Post #7





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 22.03.2005

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


Znalazlem,
po prostu przeoczyłem jedno wywolanie funkcji disable (miałem je w body onload) i tam id się nie zgadzało,
dzieki za pomoc i sorry za zawracanie głowy
Go to the top of the page
+Quote Post

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: 23.08.2025 - 13:30