By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,665 Members | 1,229 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,665 IT Pros & Developers. It's quick & easy.

displaying special characters in a <div>

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.