Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Text range object


  • From: javascript@xxxxxxxxxx (Cory Mercurio)
  • Subject: [Javascript] Text range object
  • Date: Tue, 28 May 2002 10:40:54 -0700

Hello, Andrew. Did you ever find a solution to your problem?

Bests,
-cory-

-----Original Message-----
From: Andrew Gibson [mailto:andyg@xxxxxxxxxx] 
Sent: Wednesday, May 22, 2002 2:55 AM
To: javascript@xxxxxxxxxx
Subject: [Javascript] Text range object


I'm trying to replace the HTML code in a text range

say I select some text   "<b>test</b>"

// this selects the range
var r=document.selection.createRange()

// this can delete the text in the range
r.text=""

but leaves the html portion as "<b></b>"

I gather r.textHTML is a read only property so I can't change it that way!

I wan to be able to remove  or edit the html portion

eg

"<b>text</b>"  >>  "text"

I know I can do this through something like this

document.execCommand("Bold") which toggles the <b> on and off

but on some other commands, it throws in some unwanted <P>  which mucks up
the display!

Andrew




_______________________________________________
Javascript mailing list
Javascript@xxxxxxxxxx https://lists.LaTech.edu/mailman/listinfo/javascript