469,277 Members | 2,276 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,277 developers. It's quick & easy.

how to do rowspan and colspan with DOM

130 100+
hello all,

i am trying to create a table useing dom and its going well but
was wondering how can i join rowa or join tbs

i can make this kind of table with no problam
_________
|..............|
---------------
|..............|
---------------
|..............|
---------------
|..............|
---------------
but how i can do it like this
__________________
| ..............|..............|
| ..............|..............|
|rowspan |--------------|
| ..............|..............|
| ..............|..............|
|------------------------------|
is there a way?
Oct 31 '07 #1
3 8080
dmjpro
2,476 2GB
How much you tried .... Please show me that code ....

Debasis
Oct 31 '07 #2
Amzul
130 100+
How much you tried .... Please show me that code ....

Debasis
lol, i posted this before so....
any way here is is :
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.  
  3.     document.getElementsByTagName("pre")[0].innerHTML ="";    //clear previues displays in the <pre>
  4.     var body = document.getElementsByTagName("pre")[0];         //put the table in <pre> here </pre>
  5.     var tbl  = document.createElement("table");                 //create table element
  6.     var tblBody = document.createElement("tbody");     
  7.  
  8.         for (var j = 0; j < 4; j++)                     //creating all cells
  9.         { 
  10.             var row = document.createElement("tr");         //creates a table row
  11.             row.setAttribute("height","39");                    //BTW cant control the higeht in  html?
  12.             for (var i = 0; i < 1; i++) 
  13.             {
  14.                 var cell = document.createElement("td");                        //Create a <td> element
  15.                 var linktd='<a href="www.google.com">google</a>';
  16.                 cell.innerHTML = linktd 
  17.                 cell.setAttribute("align","center");                            //set the aligen for the tdl    
  18.                 row.appendChild(cell);            //put the <td> at the end of the table row
  19.             }
  20.             tblBody.appendChild(row);                                 //add the row to the end of the table body
  21.         }
  22.     tblBody.appendChild(row);
  23.     tbl.appendChild(tblBody);
  24.  
  25.         tbl.appendChild(tblBody);                                    //put the <tbody> in the <table>
  26.         body.appendChild(tbl);                          // appends <table> into <body>
  27.         tbl.setAttribute("cellpadding","0");                                    // no cellpadding in the table
  28.         tbl.setAttribute("cellspacing","0");                                    // no cell spacing in the table
  29.         tbl.style.color = color_font;                                 //font color on the links
  30.         tbl.style.backgroundColor = bgcolor_r;                  //bgcolor for table
  31.         tbl.setAttribute("height",size_y_banner);
  32.         tbl.setAttribute("width",size_x_banner);
  33.         tbl.setAttribute("border",border_size1);            
  34. }
  35. </script>
hope u can help :)
Oct 31 '07 #3
acoder
16,027 Expert Mod 8TB
Use the rowSpan property.
Oct 31 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Martin Brunner | last post: by
28 posts views Thread by Greg Adourian | last post: by
19 posts views Thread by Logix | last post: by
6 posts views Thread by htmlrookie | last post: by
12 posts views Thread by plugwalsh | last post: by
7 posts views Thread by Gawel | last post: by
7 posts views Thread by Matt Kruse | last post: by
reply views Thread by simon | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.