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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Very difficult DHTML:How to add css font class to table cells

Status
Not open for further replies.

faraway

Programmer
Jun 26, 2003
11
CA
Hi,

We use a HTML Editor, when highligt certain text, we can change its CSS format by DHTML, but when we select text in more than 1 table cells, it doesn't work and got "upspecified error", here is the code:

var whichPara = ctrlHTML.DOM.selection.createRange();
var selType=ctrlHTML.DOM.selection.type;

if(selType!="Control"){
if(whichPara!=null){
outString = addFontStyle(whichPara.htmlText,thisStyle);
whichPara.pasteHTML(outString);
}

I think that is because the table cells are read only for the pasteHTML, does any one knows how to solve this problem?

Thanks,
 
Hi,

Well, your question relates to CSS rather than Javascript.

The problem relates to your editor. Here's what you wanna do:

Each cell that you want to look the same should have the CLASS or ID added. Something like this:

[tt]
<TD CLASS=&quot;muchBetter&quot;>
whatever you want to read
</TD>.
[/tt]

The appearence of this cell-centents can be edited in the stylesheet in this section:

[tt]
.muchBetter {
color : red;
font-weight:bold;
}
[/tt]

Sounds like black-speech to you? Then talk to a buddy that knows HTML and CSS -he/she should be able to fix it for you quite easily.

Hope this helps you in the right direction §;O)


Jakob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top