Click to See Complete Forum and Search --> : Including the HTML-tags in a textrange


Nejt
07-27-2003, 11:21 AM
Hey guys, I've run into a big problem when building an application that needs to extract a certain textRange with the HTML-tags included. It works fine in IE when using

document.selection.createRange().htmlText

but Netscape/Mozilla doesn't implement that method, the only one I've found is the method

document.getSelection()

which doesn't seem to include the HTML-tags.

Is there perhaps any other way i can get this to work with NS/Mozilla??

Khalid Ali
07-27-2003, 01:59 PM
if I understood you correctly replace
< with &amp;lt;
and
> with &amp;gt;

I am sure this will work

Nejt
07-27-2003, 03:14 PM
Thanks for replying, i dont think thats quite what I'm after though. Let me elaborate a bit.

What i want is this:

When the user selects part of the html-document, I need for the selected string to also contain possible html-tags that could have been selected, not just the plain text.

In IE im able to do this, but in Netscape the method document.getSelection() returns only plain text and ignores the html "behind" it.

Does this make sense?