Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Create rows and columns dynamically in html webpage

$
0
0

Hi,

Im trying to create a html webpage to return rows and columns...

 function addRow() {
        debugger;
        var tab = document.createElement("table");
        tab.border = 1;
        var count = 4;

        for (var i = 0; i < count ; i++) {

            var row = document.createElement("tr");
            var cell = document.createElement("td");

            cell.textContent = "abd";
            row.textContent = "xyz";

            row.appendChild(cell);
            tab.appendChild(row);

            var div = document.getElementById("div1");
            div.appendChild(tab);
        }
    }</script></head><body onload="addRow()"><div id ="div1" ></div></body></html>

Im using the below code.. bt im able to retrieve only correct number of rows but only two columns... what is the code i need to add for this..


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>