Dynamic table, setting v-align of a new cell

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rich Morey

    #1

    Dynamic table, setting v-align of a new cell

    Hello,

    I am working on something that only needs to work in IE, and I've got
    this code:

    var aRows=oTable.ro ws;
    var oCell1_1=aRows( 0).insertCell() ;
    oCell1_1.innerH TML= 'new cell'

    Which inserts a row in my table and I can populate the cell with the
    text using the innerHTML property. No problem.

    My question is, how do I set the VALIGN of this new cell?

    I have tried this..

    oCell1_1.valign ='top'

    and that does not generate a JavaScript error but it doesn't
    vertically align the text in the cell either.

    Other attempts generate javascript errors..

    Can someone please help!

    Thanks,

    Rich
  • Lasse Reichstein Nielsen

    #2
    Re: Dynamic table, setting v-align of a new cell

    rwmorey@27east. com (Rich Morey) writes:
    [color=blue]
    > My question is, how do I set the VALIGN of this new cell?[/color]

    Probably using the CSS style:
    oCell1_1.style. verticalAlign = "top";

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Lasse Reichstein Nielsen

      #3
      Re: Dynamic table, setting v-align of a new cell

      DU <drunclear@hotR EMOVEmail.com> writes:
      [color=blue]
      > var oCell1_1=aRows[0].insertCell(i);[/color]
      ....[color=blue]
      > If you're going to insert only a text node, then it's preferable to use
      > oCell1_1.firstC hild.nodeValue= 'new cell';
      >
      > rather than use innerHTML[/color]

      In a brand new td node, there is no firstChild. In this case, you should
      rather do a
      oCell1_1.append Child(document. createTextNode( 'new cell'));
      to create the text node.
      [color=blue][color=green]
      > > oCell1_1.valign ='top'[/color][/color]
      [color=blue]
      > This might depend on the browser and browser version.
      >
      > The correct syntax is with vAlign, otherwise a script error should
      > have been generated and reported.[/color]

      Not necessarily. The DOM node is a host object, so behavior doesn't
      have to follow Javascript objects, but I haven't seen a DOM
      implementation yet that didn't allow you to create any property.
      It's not an error. It just won't do anything.

      /L
      --
      Lasse Reichstein Nielsen - lrn@hotpop.com
      Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
      'Faith without judgement merely degrades the spirit divine.'

      Comment

      Working...