I am using a multiline text in xul and in I need to display a string. however part of the string needs to be in italics and if a use the .italics() method in javascript all that's displayed is the Blink! tags next to the string. Is there another way to make the string italics using javascript?
Asked
Active
Viewed 1,984 times
2 Answers
1
- String.prototype.italics() just wrap the text with
<i>
and</i>
, this only works in HTML not XUL. - When you say 'a multiline text', are you reference to
<textbox>
element in XUL? If so this wrapper doesn't work with rich text. try some other element to contain your text.

xiaoyi
- 6,641
- 1
- 34
- 51
-
yes it is a textbox element, I tried to use a description element but I got the same error – Monalisa Nkhata May 23 '12 at 06:26
-
@MonalisaNkhata check out https://developer.mozilla.org/en/XUL_School/The_Box_Model Text Links section, I think it might help. – xiaoyi May 23 '12 at 06:41
0
I am not positive if this works on a XUL-document, but you could try the style-object:
document.getElementById("myString").style.fontStyle = "italic";

AvL
- 3,083
- 1
- 28
- 39