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

Need help with textRange.pasteHTML

Status
Not open for further replies.

Tiono

Programmer
Feb 24, 2004
11
0
0
ID
Hi, i have a problem to modify html text.

i need to insert a [header][/header] tag in a textarea. if user has select some text, then the [header] tag must place at start of the 1st html tag before the text selected and the [/header] must place in the last HTML tag.

e.g :

if user select "this is a trial text" which HTML source is <p><font color="#FF0000">this is a trial text</font></p> and then user click the header button, then i need to place [header] tag before the <p> start tag and [/header] after <p> closing tag.

I set the range text with pasteHTML but the HTML tag is always outside [header][/header] tag. Is there another method that I can use to change/modify selected text in textarea???

best regards,
Tiono
 
Nobody could help me :( ??

i'm using selection.createRange() then i get the range.htmlText and add the [header][/header] tag to it. then I use createRange().pasteHTML() method to paste the new tag. but that will create duplicate html tag to the selection.

sigh....
 

Have you tried "googling" for "createRange javascript"?

I had found the answer to my copy/paste problem like that a few days ago.

Hope this helps,
Dan
 
what is googling??? could you explain it??
 
oooooo i know what is googling, u mean search at google, right? :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top