How to assign colspan to a table cell in javascript

Discussion in 'Javascript' started by manoj, Feb 25, 2008.

  1. manoj

    manoj Guest

    Hi,

    I am generating html table dynamically by javascript.
    I want to access colspan properties of table cell.
    What can be the way to achieve this?

    The code snippet is :-

    for(i=0;i<parms.length-1;i++)
    {
    var GrpNames = parms.split(',');

    Row = window.tblvalue.insertRow();

    Row.style.width='100%';
    Row.align="right";

    Cell = Row.insertCell();

    Cell.colspan=' 2 ' //This code doesnt work

    Cell.innerHTML="<a href='' style='Color:blue'
    onclick='return
    ShowCritGroupDetailList("+GrpNames[0]+")'>"+GrpNames[1]+"</
    a>";

    Cell = Row.insertCell();

    Cell.innerHTML="<input type=checkbox name=chk_" + i +"
    id="+GrpNames[0]+"; value='C'>";


    }
     
    manoj, Feb 25, 2008
    #1
    1. Advertising

  2. manoj

    Henry Guest

    On Feb 25, 9:12 am, manoj wrote:
    > I am generating  html table dynamically by javascript.
    > I want to access colspan properties of table cell.
    > What can be the way to achieve this?

    <snip>
    >            Cell.colspan=' 2 ' //This code doesnt work

    <snip>
    In case-sensitive javascript it is important to use the correct
    sequence of upper and lower case letters in property names. In this
    case the 'S' in 'span' should be a capital.

    Cell.colSpan = 2;

    (and the expectation would be that the value assigned should be
    numeric and not a string.)
     
    Henry, Feb 25, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Glen K
    Replies:
    4
    Views:
    7,945
    PeterMcC
    Jul 14, 2004
  2. Logix
    Replies:
    23
    Views:
    11,668
    Isofarro
    Aug 27, 2004
  3. cho.cabot
    Replies:
    3
    Views:
    1,197
    Jonathan N. Little
    Nov 13, 2006
  4. rob merritt

    asp:table equivalent of colspan???

    rob merritt, Apr 17, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    841
    Teemu Keiski
    Apr 18, 2004
  5. Matt Kruse
    Replies:
    9
    Views:
    405
    mick white
    Nov 30, 2006
Loading...

Share This Page