Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Problem z innerHTML w IE 7
snipe
post 5.05.2008, 08:48:12
Post #1





Grupa: Zarejestrowani
Postów: 135
Pomógł: 1
Dołączył: 5.10.2005
Skąd: Opole/Chorzów

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


Mam problem z nadawaniem wartości dla innerHTML w Internet Explorer 7. Z tego co wiem to wina samej przeglądarki tongue.gif ma ktoś pomysł jak to obejść/naprawić?

Pozdrawiam
Snipe


--------------------
Go to the top of the page
+Quote Post
batman
post 5.05.2008, 08:49:51
Post #2





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Pokaż kod, bo inaczej będę musiał sięgnąć po kryształową kulę. A wolałbym tego uniknąć, ponieważ mam nagrabione w ministerstwie magii smile.gif


--------------------
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.
Go to the top of the page
+Quote Post
snipe
post 5.05.2008, 08:53:31
Post #3





Grupa: Zarejestrowani
Postów: 135
Pomógł: 1
Dołączył: 5.10.2005
Skąd: Opole/Chorzów

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


kod jest banalny więc niepotrzebna kula tongue.gif
Kod
var layer = document.getElementById('users');
layer.innerHTML = 'tutaj nadajemy wartosc';


Przypominam, że to nie działa w IE7 tongue.gif


--------------------
Go to the top of the page
+Quote Post
batman
post 5.05.2008, 08:54:35
Post #4





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




Zmień layer na np. layer123 i zobacz czy zadziała. Coś mi się wydaje, że layer jest zarezerwowaną nazwą w javascript dla IE.
edit
Poza tym u mnie działa pod IE7 winksmiley.jpg


--------------------
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.
Go to the top of the page
+Quote Post
snipe
post 5.05.2008, 08:55:49
Post #5





Grupa: Zarejestrowani
Postów: 135
Pomógł: 1
Dołączył: 5.10.2005
Skąd: Opole/Chorzów

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


próbowałem z innymi nazwami winksmiley.jpg też nie działa tongue.gif

Ten post edytował snipe 5.05.2008, 08:56:04


--------------------
Go to the top of the page
+Quote Post
batman
post 5.05.2008, 08:57:52
Post #6





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




To sprawdź jeszcze, czy element, do którego się odwołujesz istnieje, tzn, czy ma nadane odpowiednie id (sprawdź pod kątem literówek).


--------------------
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.
Go to the top of the page
+Quote Post
snipe
post 5.05.2008, 09:05:26
Post #7





Grupa: Zarejestrowani
Postów: 135
Pomógł: 1
Dołączył: 5.10.2005
Skąd: Opole/Chorzów

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


z id jest na pewno ok, w końcu inne przeglądarki bez problemu nadają innerHTML tongue.gif więc to nie to smile.gif


--------------------
Go to the top of the page
+Quote Post
sniezny_wilk
post 5.05.2008, 09:45:27
Post #8





Grupa: Zarejestrowani
Postów: 732
Pomógł: 80
Dołączył: 25.05.2005
Skąd: Szczecin

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


Daj trochę więcej kodu (HTML, JS).. może źle odwołujesz sie do elementu, albo odwołanie do elementu masz przed tworzeniem go.

Ten post edytował sniezny_wilk 5.05.2008, 09:50:34


--------------------
Go to the top of the page
+Quote Post
batman
post 5.05.2008, 09:50:07
Post #9





Grupa: Moderatorzy
Postów: 2 921
Pomógł: 269
Dołączył: 11.08.2005
Skąd: 127.0.0.1




  1. window.onload = function() {
  2. var layer = document.getElementById('users');
  3. layer.innerHTML = 'tutaj nadajemy wartosc';
  4. }
  5. <div id="users"></div>

Działa na IE7 i Fx.


--------------------
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.
Go to the top of the page
+Quote Post
snipe
post 5.05.2008, 09:55:43
Post #10





Grupa: Zarejestrowani
Postów: 135
Pomógł: 1
Dołączył: 5.10.2005
Skąd: Opole/Chorzów

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


kod html:
  1. <tr>
  2. <th><input type="checkbox" /></th>
  3. <th><a href="">Pole 1</a></th>
  4. <th><a href="">Pole 2</a></th>
  5. <th><a href="">Pole 3</a></th>
  6. <th><a href="">Pole 4</a></th>
  7. </tr>
  8. </thead>
  9. <tbody id="users_table_tbody">
  10. </tbody>
  11. </table>



funkcja którą wywołuje:
Kod
function getUsers() {
    var user_table = document.getElementById('users_table_tbody');
    user_table.innerHTML = "";
}


po załodowaniu strony uruchamiam funkcję getUsers()
Kod
window.onload = function() {
    getUsers();
}


--------------------
Go to the top of the page
+Quote Post
sniezny_wilk
post 5.05.2008, 09:59:42
Post #11





Grupa: Zarejestrowani
Postów: 732
Pomógł: 80
Dołączył: 25.05.2005
Skąd: Szczecin

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


Google->poczytaj('tbody innerHTML'); błąd IE związany z wrzucaniem kodu do tabeli. Zobacz kilka pierwszych linków, tam gdzieś jest rozwiązanie.


--------------------
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 31.07.2025 - 08:58