SoFunction
Updated on 2025-04-03

javascript dynamically create tables


<html>
        <head>
            <script>
                function createTable(rows,lines){
                    =rows;
                    =lines;
                    var Body=('body');
var Table=('table');//Create table tag element
                    ('border','1');
//Add other attributes to the table tag
                    for(var i=0;i<;i++){
                        var lRow=('tr');
                        for(var j=0;j<;j++){
                            var textNode=(i+','+j);
                            var lLine=('td');
                                (textNode);
                            (lLine);
                        }
                        (lRow);
                    }
                    (Table);
                }
            </script>
        </head>
        <body >
            <div ></div>
        </body>
        <script type="text/javascript">
            createTable(10,10);
        </script>
</html>