Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

table border and javascript

Status
Not open for further replies.

frkimrki

Programmer
Jun 30, 2005
2
BA
when i set a border to table with javascript :

table.style.border = '1px solid #000000';

i got someting like this :

<table style="border-left:1px solid #000000;border-top:1px solid #000000;border-right:1px solid #000000;border-bottom:1px solid #000000;">
...
</table>

How can i avoid this "-left, -top, ..." and get only style="border:1px solid #000000;" ?
 
You get that because you are looking into cssText, if you just look at the property .style.border you get that right-hand-side.

How to put it...
[tt] table.style.borderRightStyle="solid"[/tt]
then alert(table.style.cssText) will give you the exact and nothing else.
[tt] BORDER-RIGHT-STYLE:solid[/tt]

Or to put it figuratively, .border property assignment is a shortcut to set at the same time borderRightStyle, borderRightWidth, borderRightColor,...(left, top, bottom)... totally 12 properties.

Does this viewpoint make things all fall into places?

 
Which has nothing to do with why you are seeing what you are seeing, but is a good idea nonetheless. It definitely makes your borders look neater.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top