468,245 Members | 1,668 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,245 developers. It's quick & easy.

displaying special characters in a <div>

I have a problem displaying a divbox containing a html-textarea -
everything works fine with "normal" characters. However, when the
textarea contains special chars like <P> or ' , the box fails to show:

function show(divbox)
{
divbox.style.display='';
}

<div id="divbox" style="display:none" >
<form action="action.php" method="post>
<textarea name ="txt">Text</textarea>
</form>
</div>

If the Text in the textarea is for instance
HERE IS A "QUOTE"

it works fine, while
HERE IS A 'QUOTE'
produces an error

<br>-tags works fine, but
<p>-tags doesn't

Hmmm - hope someone can help...

:o)
Jens

Jul 20 '05 #1
3 6199
VK
use &lt; and &gt; instead
&lt;P&gt; not <P>
Jens Kristensen <gr*****@stofanet.dk> wrote in message
news:3F***************@stofanet.dk...
I have a problem displaying a divbox containing a html-textarea -
everything works fine with "normal" characters. However, when the
textarea contains special chars like <P> or ' , the box fails to show:

function show(divbox)
{
divbox.style.display='';
}

<div id="divbox" style="display:none" >
<form action="action.php" method="post>
<textarea name ="txt">Text</textarea>
</form>
</div>

If the Text in the textarea is for instance
HERE IS A "QUOTE"

it works fine, while
HERE IS A 'QUOTE'
produces an error

<br>-tags works fine, but
<p>-tags doesn't

Hmmm - hope someone can help...

:o)
Jens

Jul 20 '05 #2
Jens Kristensen <gr*****@stofanet.dk> writes:
I have a problem displaying a divbox containing a html-textarea -
everything works fine with "normal" characters. However, when the
textarea contains special chars like <P> or ' , the box fails to show:
What, exactly, is supposed to happen, and what happens (and in which
browser)?
function show(divbox)
{
divbox.style.display='';
}
How is this function called?
<div id="divbox" style="display:none" >
<form action="action.php" method="post>
You are missing a " after "post". That can very well give problems.
<textarea name ="txt">Text</textarea>
</form>
</div>

If the Text in the textarea is for instance
HERE IS A "QUOTE"

it works fine, while
HERE IS A 'QUOTE'
produces an error
Neither " nor ' are special characters in HTML, except inside tags,
so it shouldn't matter which you use.
I guess that the missing " could give that effect.
<br>-tags works fine, but
<p>-tags doesn't


Where? Inside the textarea element?
The content of the textarea is not HTML, and you should not write tags
there. If you need to write the text "<br>", do it as &lt;br&gt;. If you
need a newline, make one in the source.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3
I have finally spotted the problem, which was - not the html tags, but the
line-break ,\n, which in another line caused the script to stall.
Removing the \n-code solved the problem.

Thank you for helping me with the problem

:o)
Jens

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Paul Thompson | last post: by
8 posts views Thread by Daniel Hansen | last post: by
7 posts views Thread by Dario de Judicibus | last post: by
3 posts views Thread by Josef K. | last post: by
28 posts views Thread by Kent Feiler | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.