Click to See Complete Forum and Search --> : help debug javascript


esthera
07-28-2004, 12:06 PM
I am using htmlarea from interactive tools.

I have edited the code but I am running into problems --

What the below code does is wraps <font class=xxx> before the text.
The problem is the code below is not closing the font tag after the text so I end up having html like the following

<FONT class="articledate"> xxxxx
<BR><FONT class="ecstyle"> xxxx
<BR><FONT
class="pagetitle"> dfdfdfdfd</FONT></FONT></FONT>

I need it to close the font before it opens the new font.
Any ideas? Please help.


Here is the relavant code:


else if (cmdID == 'FontStyle' && val) {
if(val!="remove"){
var rng = editdoc.selection.createRange();
if (rng.text.length > 0)
{editor_insertHTML(objname, '<FONT class="' + val + '">' + rng.text + '</FONT>');}
else
{editor_insertHTML(objname, '<FONT class="' + val + '">&nbsp;</FONT>');}

button_obj.selectedIndex =0;
}
else{
var rng = editdoc.selection.createRange();
fontArray = getFont(rng.parentElement());
fontArray.outerHTML = fontArray.innerHTML;
}
}

Mellowz
07-28-2004, 03:30 PM
Is this what you want? If it isn't sorry, but this is the closest I could think of:

<FONT class="articledate">xxxxx</FONT>

esthera
07-29-2004, 12:40 AM
yes that what the final should like -- how do I do it through the javascript?

HaganeNoKokoro
07-29-2004, 12:48 AM
Can we see all the code, not just the relevent part? Sometimes the problem comes from the least expected thing...

esthera
07-29-2004, 01:15 AM
Attached is a zip of the js file.

It's on line 705.

Thanks