[Javascript] Text range object

Andrew Gibson andyg at ihug.co.nz
Thu May 30 00:38:38 CDT 2002


Thanks cory I did. The problem was that on hitting an enter button, it
threw(correctly) a <br> into the HTML source. But it also enclosed the
previous line in a <p>  </p> or something like that, meaning an extra line.

So I just replaced the <br> 's  with ''  and seemes to work ok..


> Hello, Andrew. Did you ever find a solution to your problem?
>
> Bests,
> -cory-
>
> 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"
>






More information about the Javascript mailing list