Sasa Posted February 15, 2008 Report Share Posted February 15, 2008 Ja es gribu ar javascript zīmēt HTML tabulas, tad man kaut kā tā darīt: document.write('<table border = "1">'); document.write('<tr>'); document.write('<td>Cell A</td>'); document.write('<td>Cell b</td>'); document.write('</tr>'); document.write('</table>'); vai arī ir kāds cits variants?? Link to comment Share on other sites More sharing options...
andrisp Posted February 15, 2008 Report Share Posted February 15, 2008 JS DOM metodes (createNode utt). Pagūglē. Bet bieži ērtāk un efektīvāk ir saģenerēt tabulas HTML kā stringu un tad vajadzīgajā vietā ievietot ar innerHTML. Link to comment Share on other sites More sharing options...
Sasa Posted February 15, 2008 Author Report Share Posted February 15, 2008 ja es nezinu cik man ailītes vajadzēs! vai tad nebūs ērtāk šādi? for(i=0;i<skaits;i++){ document.write('<td>'+document.all('kods',i).innerHTML+'</td>'); } Link to comment Share on other sites More sharing options...
andrisp Posted February 15, 2008 Report Share Posted February 15, 2008 Godīgi sakot, es nesaprotu, ko tu tur mēģini izdarīt. Ja tu nezini cik ailītes, tad tādā pašai veidā ar for tu vari saģenerēt stringu: var html = '<table><tr>'; for(i=0;i<skaits;i++){ html += '<td></td>'; } html += '</tr></table>'; document.getElementById('elementa_id_kuraa_baaziisi_savu_tabulu').innerHTML = html; Link to comment Share on other sites More sharing options...
v3rb0 Posted February 15, 2008 Report Share Posted February 15, 2008 var ar kādu no tiem, ko sauc par "dom builderiem" - tikko atradu šitādu http://www.allcrunchy.com/Web_Stuff/Dom_Builder/ , iepatikās dēļ sava vienkāršuma. Link to comment Share on other sites More sharing options...
Recommended Posts