Connecting Tech Pros Worldwide Forums | Help | Site Map

table row property DOM2

sudhaoncyberworld@gmail.com
Guest
 
Posts: n/a
#1: Dec 5 '05
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


RobG
Guest
 
Posts: n/a
#2: Dec 6 '05

re: table row property DOM2


sudhaoncyberworld@gmail.com wrote:[color=blue]
> Pl excuse me if my question is silly
>
> var tbl=document.createElement('TABLE');
> var tr=tbl.insertRow();[/color]

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).

<URL:http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-39872903>

[color=blue]
> tr.id='tr1';
> tr.style.borderWidth='thin';
> tr.style.borderStyle='ridge';
> tr.style.borderColor='blue';
> var td=tr.insertCell();[/color]

The same advice goes applies to insertCell.

<URL:http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-68927016>

[color=blue]
> 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[/color]

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

<URL:
http://groups.google.com/group/comp....b2b2935467fd4c[color=blue]
>[/color]



--
Rob
sudhaoncyberworld@gmail.com
Guest
 
Posts: n/a
#3: Dec 6 '05

re: table row property DOM2


Thanks

sudhaoncyberworld@gmail.com
Guest
 
Posts: n/a
#4: Dec 6 '05

re: table row property DOM2


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

Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#5: Dec 6 '05

re: table row property DOM2


sudhaoncyberworld@gmail.com wrote:
[color=blue]
> My problem is i have a table with n rows.[/color]

OK.
[color=blue]
> And onmouseover event[/color]

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

Left border of what -- table, row(s) or cell(s)?
[color=blue]
> 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.[/color]

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

<URL:http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-MouseEvent>
[color=blue]
> And it is also not easy to put all those td's into a new table according
> to my code,[/color]

Why you would have to?
[color=blue]
> hope u understand my problem[/color]

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
Closed Thread


Similar JavaScript / Ajax / DHTML bytes