Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [javascript] problem z IE, pomocy
gibffe
post 8.09.2006, 19:33:26
Post #1





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 23.09.2004

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


Witam, ponizej zamieszczam kod ktory przedstawia prolem.
Klikajac fillTable (pod firefoxem) w td o id content tworzone sa
jednowierszowe tabele ktore sie wyswietlaja. Pod IE tabele sie tworza,
sa jako dzieci owego td (sprawdzalem w dom inspect) jednak nie odswieza
sie content tego td - nie widac zmian. Co z tym zrobic ?

  1.  
  2. </head>
  3.  
  4.  
  5. <script type="text/javascript">
  6. function fillTable() {
  7. var oTable = document.createElement("table");
  8. var oTr = oTable.appendChild(document.createElement("tr"));
  9. var oTd = oTr.appendChild(document.createElement("td"));
  10. oTd.innerHTML = "aaa";
  11.  
  12. var content = document.getElementById("content");
  13. content.appendChild(oTable);
  14. }
  15.  
  16.  
  17.  
  18. <a href="java script:fillTable();">fill table</a>
  19. <tr>
  20. <td id="content"></td>
  21. </tr>
  22. </body>
  23. </html>


ok problem sie rozwiazal, trzeba samemu dodawac tBody, firefox go ignoruje i wyswietla tabele
tak czy inaczej, IE nie
Go to the top of the page
+Quote Post
revyag
post 9.09.2006, 00:50:08
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 258
Pomógł: 16
Dołączył: 21.09.2004
Skąd: Kielce

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


W złej kolejności dodajesz elementy. Musisz to robić w górę drzewa DOM czyli
Kod
var oTable = document.createElement("table");
var oTr = document.createElement("tr");
var oTd = document.createElement("td");

oTd.innerHTML = "aaa";
oTr.appendChild(oTd);
oTable.appendChild(oTr);

var content = document.getElementById("content");
content.appendChild(oTable);


--------------------
-------------

------
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: 7.07.2025 - 01:45