hi!
i'm using textarea to type the contents.
inwhich i need to make the text as italic
if i use the following code i'm not getting the italic text instead i'm getting the html tags like <i>text</i> around the text.
how can i rectify these problem.
give me some suggestion.
[HTML] <textarea rows="13" name="messages" cols="65" tabindex="5" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1">
<input type="button" value=" I& nbsp;" name="Italic" tabindex="7" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" onclick="insert Italic()">
[/HTML]
i'm using textarea to type the contents.
inwhich i need to make the text as italic
if i use the following code i'm not getting the italic text instead i'm getting the html tags like <i>text</i> around the text.
how can i rectify these problem.
give me some suggestion.
[HTML] <textarea rows="13" name="messages" cols="65" tabindex="5" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1">
<input type="button" value=" I& nbsp;" name="Italic" tabindex="7" style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" onclick="insert Italic()">
[/HTML]
Code:
function insertItalic() { var str = document.selection.createRange().text; document.compose.messages.focus(); var sel = document.selection.createRange(); sel.text=str.italics(); return;
Comment