table row property DOM2

  • Thread starter sudhaoncyberworld
  • Start date
S

sudhaoncyberworld

Pl excuse me if my question is silly

var tbl=document.createElement('TABLE');
var tr=tbl.insertRow();
tr.id='tr1';
tr.style.borderWidth='thin';
tr.style.borderStyle='ridge';
tr.style.borderColor='blue';
var td=tr.insertCell();
var txt=document.createTextNode('ABC1');
td.appendChild(txt);
var td=tr.insertCell();
var txt=document.createTextNode('ABC2');
td.appendChild(txt);
var tr=tbl.insertRow();
tr.id='tr2';
tr.style.borderStyle='none';
var td=tr.insertCell();
var txt=document.createTextNode('ABC3');
td.appendChild(txt);
var td=tr.insertCell();
var txt=document.createTextNode('ABC4');
td.appendChild(txt);
document.body.appendChild(tbl);

Why i am not able to assign border for particular row
 
R

RobG

Pl excuse me if my question is silly

var tbl=document.createElement('TABLE');
var tr=tbl.insertRow();

insertRow requires an argument that is the index at which to insert
the row. An index of -1 will insert the row at the end (effectively
at rows.length).

tr.id='tr1';
tr.style.borderWidth='thin';
tr.style.borderStyle='ridge';
tr.style.borderColor='blue';
var td=tr.insertCell();

The same advice goes applies to insertCell.

var txt=document.createTextNode('ABC1');
td.appendChild(txt);
var td=tr.insertCell();
var txt=document.createTextNode('ABC2');
td.appendChild(txt);
var tr=tbl.insertRow();
tr.id='tr2';
tr.style.borderStyle='none';
var td=tr.insertCell();
var txt=document.createTextNode('ABC3');
td.appendChild(txt);
var td=tr.insertCell();
var txt=document.createTextNode('ABC4');
td.appendChild(txt);
document.body.appendChild(tbl);

Why i am not able to assign border for particular row

That will be better answered in a CSS forum, see the discussion here:

<URL:
http://groups.google.com/group/comp...q=border+TR+table+row&rnum=2#7fb2b2935467fd4c
 
S

sudhaoncyberworld

My problem is i have a table with n rows. And onmouseover event of that
table i want to show left side border except for some particular rows,
So i can't write this in td of that tr to ignore it, since i have many
td's and it will not fire onmouseover event on all td's at a time. And
it is also not easy to put all those td's into a new table according to
my code, hope u understand my problem

Thanks
 
T

Thomas 'PointedEars' Lahn

My problem is i have a table with n rows.
OK.

And onmouseover event

You mean the `mouseover' event. `onmouseover' is merely its handler.
of that table i want to show left side border except for some particular
rows,

Left border of what -- table, row(s) or cell(s)?
So i can't write this in td of that tr to ignore it, since i have many
td's and it will not fire onmouseover event on all td's at a time.

Does not matter. The `mouseover' event will by default bubble up to the
parent `table' element where you can handle it.

And it is also not easy to put all those td's into a new table according
to my code,

Why you would have to?
hope u understand my problem

Not really.

Please quote what you are replying to, and trim those quotes:
<URL:http://jibbering.com/faq/faq_notes/pots1.html>

<FAQENTRY>
For Google Groups, click first Options and then Reply.
(This advice should go into the FAQ notes.)
</FAQENTRY>


PointedEars
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top