how to break a table into two tables with javascript?
-
hi: now,i want use javascript to break a table into two tables like below:
now,i mean that,i want add html code of "" in "",change the table of "t1" into two tables. how can i do with javascript? thx:):):) One is never too old to learn
-
You can't. You have to add another table to the page and move the rows into it. What is it that you are trying to accomplish, really?
Experience is the sum of all the mistakes you have done.
-
Hi,Guffa,thanks for your answer.maybe i know how to do it.;)
One is never too old to learn
Untitled Page function createTable(rows,cols){ var table = document.createElement("TABLE"); var newAttr = document.createAttribute("border"); newAttr.nodeValue = "1px" table.setAttributeNode(newAttr); for(var i=0;i<rows;i++){ var row = document.createElement("TR"); for(var j=0;j<cols;j++){ var cell = document.createElement("TD"); cell.innerHTML = "Row : " + i + "Col : " + j; row.appendChild(cell); } table.appendChild(row); } showThisInBody(table); } function showThisInBody(obj){ document.body.appendChild(obj); } Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) Please vote the message if it's useful.. Thanks.