Jump to content
bijan

add Css to table row

Recommended Posts

I use :var ax=document.getElementById('table_id').rowsax[1].align="center"for the row alignment, What if I want to set an style(css class), to this row.How should i do that ?

Share this post


Link to post
Share on other sites

JavaScript Function:function test(id){ if(document.getElementsByTagName) { var table = document.getElementById(id); table.className="test"; //CSS Classname }}CssClass:.test{ text-align:center; }HTML:<body onload="test('trial')">.......<table id="trial">.......Hope this is what you were looking for......

Share this post


Link to post
Share on other sites
var ax=document.getElementById('table_id').rowsax[1].style.textAlign="center"

or

var ax=document.getElementById('table_id').rowsax[1].className="css class name"

With the class name you have to define your css class first

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...