Connecting Tech Pros Worldwide Help | Site Map

table row property DOM2

 
LinkBack Thread Tools Search this Thread
  #1  
Old December 5th, 2005, 01:45 PM
sudhaoncyberworld@gmail.com
Guest
 
Posts: n/a
Default table row property DOM2

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


  #2  
Old December 6th, 2005, 02:45 AM
RobG
Guest
 
Posts: n/a
Default 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
  #3  
Old December 6th, 2005, 11:45 AM
sudhaoncyberworld@gmail.com
Guest
 
Posts: n/a
Default Re: table row property DOM2

Thanks

  #4  
Old December 6th, 2005, 11:55 AM
sudhaoncyberworld@gmail.com
Guest
 
Posts: n/a
Default 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

  #5  
Old December 6th, 2005, 02:35 PM
Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
Default 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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.