Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Tabela, wiersz po wierszu - innerHTML
Malinaa
post
Post #1





Grupa: Zarejestrowani
Postów: 573
Pomógł: 6
Dołączył: 21.07.2008

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


Witam,

mam taką pętle:

[js]
for(i=0;i<response.result.length;i++) {
var div = document.createElement('div');
div.style.display = 'block';

div.innerHTML = '<table width="100%" cellspacing="1" cellpadding="0" border="0"><tr><td align="left" valign="middle" width="20">'+response.result[i].message+'</td></tr></table>';

document.getElementById('sb_Log').appendChild(div);
}
[/js]

a chciałbym mieć tak:

[js]
var div = document.createElement('div');
div.style.display = 'block';

div.innerHTML = '<table width="100%" cellspacing="1" cellpadding="0" border="0">'; // Not ok

for(i=0;i<response.result.length;i++) {
div.innerHTML = '<tr><td align="left" valign="middle" width="20">'+response.result[i].message+'</td></tr>';

document.getElementById('sb_Log').appendChild(div); // Co z tym ? ? ?
}

div.innerHTML = '</table>'; // Not ok
[/js]

Jak to zrobić, aby działało prawidłowo, tworzyło div.innerHTML krok po kroku, wiersz za wierszem, a nie jak jest teraz całe tabele?

Ten post edytował Malinaa 1.09.2010, 10:02:32
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: 22.08.2025 - 19:22