Results 1 to 3 of 3

Thread: Setting a table cell's style?

  1. #1

    Thread Starter
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306

    Setting a table cell's style?

    Can anyone tell me why this bit of code just doesnt work please?

    Code:
    function showtab(show,count){
    	
    for(c=1;c<count+1;c++){
        if(show==c){
          document.getElementById('tabcell' + c).style='tabselected';
        }else{
          document.getElementById('tabcell' + c).style='tabunselected';
        }
      } 
    }
    All i'm trying to do is change the style of a cell when it gets clicked, the event fires but vstudio blows up on me.

    any ideas?
    Last edited by tailz; Jul 19th, 2003 at 08:02 AM.

  2. #2

    Thread Starter
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306
    the html table looks like this:

    <TABLE id="tblTabs" cellSpacing="4" cellPadding="3" width="100%" border="0">
    <TR>
    <TD id="tabcell1" noWrap align="middle" width="20%" class="tabselected">
    <a id="_ctl0_HyperLink2" href="javascript:showtab(1,3)">Image tab1 caption</a></TD>
    <TD id="tabcell2" noWrap align="middle" width="20%" class="tabunselected">
    <a id="_ctl0_HyperLink3" href="javascript:showtab(2,3)">tab 2 caption</a></TD>
    <TD id="tabcell3" noWrap align="middle" width="20%" class="tabunselected">
    <a id="_ctl0_HyperLink4" href="javascript:showtab(3,3)">tab 3 caption</a></TD>
    </TR>
    </TABLE>

  3. #3

    Thread Starter
    Hyperactive Member tailz's Avatar
    Join Date
    Jul 2002
    Posts
    306
    nevermind sorted it, using wrong property :]

    Code:
    document.getElementById('tabcell' + c).className='tabselected';

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width