javascript mencipta kemahiran tables_javascript secara dinamik

WBOY
Lepaskan: 2016-05-16 16:21:33
asal
948 orang telah melayarinya

Salin kod Kod adalah seperti berikut:


                                                                                                                                                                                                                                           fungsi createTable(baris, garisan){
This.rows=rows;
This.lines=lines;
                  var Body=document.getElementById('body');
                      var Table=document.createElement('table');//Buat elemen teg jadual
                    Table.setAttribute('sempadan','1');
//Tambahkan atribut lain pada teg jadual
for(var i=0;i                              var lRow=document.createElement('tr');
for(var j=0;j                                                                     var textNode=document.createTextNode(i ',' j);
... lLine.appendChild(textNode);
lRow.appendChild(lLine);
                                                                                                                                                                            Table.appendChild(lRow);
                 }
                       Body.appendChild(Jadual);
                }
                                                                                                                                                                                                                                                                                                                                                                                               

                                                                                                        
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan
Tentang kita Penafian Sitemap
Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!