Re: block writing



On Feb 28, 9:16 am, Joost Diepenmaat <jo...@xxxxxxxxx> wrote:
hende...@xxxxxxxxx writes:
Thanks for the replies. Unfortunately in both of those instances, I
will still have to escape the xhtml portion. That is the part I am
looking at not having to do. The <pre> tags work for preformatted
text and wouldn't apply to changing or writing content in javascript.
The second example, I will still have to escape the xhtml code because
it falls between two quotes (""). Thanks again though. If anyone
else has any ideas, please let me know.

As I said above:

var element = document.getElementById("some id");
element.appendChild(document.createTextNode("<your text>"));

That *will* escape anything.

--
Joost Diepenmaat | blog:http://joost.zeekat.nl/| work:http://zeekat.nl/


Joost,
I tried, as you suggested, and it didn't work as I thought. The
below is the code:

var element = document.getElementById("divTFooter");
element.appendChild(document.createTextNode("this is an example of a
link: <a href="test.html">link</a>"));

and I got a "missing ) after argument list" error after the quote
right before the test.html name. I will need to find something that
doesn't have quotes as the delimiters. Thanks though, any other
ideas?

Dave
.



Relevant Pages

  • Re: block writing
    ... will still have to escape the xhtml portion. ... The tags work for preformatted ... I will still have to escape the xhtml code because ... it falls between two quotes. ...
    (comp.lang.javascript)
  • Re: RegExp DoubleQuote
    ... and recieved an error that the quotes don't match. ... Notice that you officially need to escape the as well when you put them in a tag. ... not work and I recieve an error about it being malformed. ... Jesse Houwing ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: RegExp DoubleQuote
    ... I just stopped looking at it in frustration and left it without the double quotes. ... As to why you need to escape the " in this fashion. ... needs to be escaped according to the rules of the HTML specs. ... Jesse Houwing ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: RegExp DoubleQuote
    ... and recieved an error that the quotes don't match. ... As to why you need to escape the " in this fashion. ... needs to be escaped according to the rules of the HTML specs. ... Jesse Houwing ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: A critique of cgi.escape
    ... and quotes should always be escaped. ... Making cgi.escape always escape the '"' character would not break ... and would probably fix a few bugs in existing code. ...
    (comp.lang.python)