Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. how to break a table into two tables with javascript?

how to break a table into two tables with javascript?

Scheduled Pinned Locked Moved Web Development
questionjavascripthtmltutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    andylaw
    wrote on last edited by
    #1

    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

    G 1 Reply Last reply
    0
    • A andylaw

      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

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      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.

      A 1 Reply Last reply
      0
      • G Guffa

        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.

        A Offline
        A Offline
        andylaw
        wrote on last edited by
        #3

        Hi,Guffa,thanks for your answer.maybe i know how to do it.;)

        One is never too old to learn

        M 1 Reply Last reply
        0
        • A andylaw

          Hi,Guffa,thanks for your answer.maybe i know how to do it.;)

          One is never too old to learn

          M Offline
          M Offline
          Michael Sync
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups