|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Jan 2005
Città: London, United Kingdom
Messaggi: 959
|
[HTML] DOM JS
Salve, devo far generare una tabella (con naturalmente tr e td) utilizzando DOM.
Ogni 3 td deve creare iun nuovo tr... Ho provato con if(i % 3 == 0){ table.appendChild(document.createElement("tr")); } Ma non fa nulla, continua tutto sulla stessa riga. Come posso fare? grazie ![]() P.S: C'é un qualche modo per chiudere un tag creato con JS? (esempio chiudere il table [</table>])
__________________
zattix |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Dec 2002
Messaggi: 3359
|
Bhe semplice, ti ho fatto un esempietto qui
http://allejp.netsons.org/tableGenerator.html |
![]() |
![]() |
![]() |
#3 |
Senior Member
Iscritto dal: Jan 2005
Città: London, United Kingdom
Messaggi: 959
|
Non ho molto tempo per guardare che sono a scuola, ma praticamente bisogna creare anche il tbody?! :P
Grazie mille, se puoi lasciarmelo su ancora per un paio di giorni al max l'esempio mi fai un piacere ![]()
__________________
zattix |
![]() |
![]() |
![]() |
#4 |
Senior Member
Iscritto dal: Dec 2002
Messaggi: 3359
|
Certo lo lascio lì...
Si va fatto tutto, anche il tbody, altrimenti chi lo crea? ![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
Iscritto dal: Nov 2005
Città: TO
Messaggi: 5206
|
Comunque TBODY non è strettamente necessario. Le specifiche HTML dicono:
The TBODY start tag is always required except when the table contains only one table body and no table head or foot sections. The TBODY end tag may always be safely omitted.
__________________
Andrea, SCJP 5 (91%) - SCWCD 5 (94%) |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 11:12.