468,101 Members | 1,449 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Textarea Inside of a textarea

I am writing a small database utility to catalog all of my favorite
ASM/JS/VBS... functions and scripts on an asp page. Everything is going
smoothly except for one thing that I can't quite seem to think my way
around.

I am using a <textarea> to display the code but some of my scripts have
<textarea> tags in them and when the </textarea> tag is entered, it
closes my <textarea> and the rest of the code ends up outside of the
textarea.

Example: (the code after the middle </textarea> show up outside of the
textarea box)

<textarea>
code...code...code...
code...<textarea></textarea>code...
code...code...code...
</textarea>

Anyone Got any Ideas? The page/code that is giving me a headache is
here...
http://www.wperry.net/projects/codelib/detail.asp?id=19

Feb 4 '06 #1
6 5700
<textarea>
<%=Server.HTMLEncode(varMyContent)%>
</textarea>

Anthony.
Feb 4 '06 #2
<wp*****@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I am writing a small database utility to catalog all of my favorite
ASM/JS/VBS... functions and scripts on an asp page. Everything is going
smoothly except for one thing that I can't quite seem to think my way
around.

I am using a <textarea> to display the code but some of my scripts have
<textarea> tags in them and when the </textarea> tag is entered, it
closes my <textarea> and the rest of the code ends up outside of the
textarea.

Example: (the code after the middle </textarea> show up outside of the
textarea box)

<textarea>
code...code...code...
code...<textarea></textarea>code...
code...code...code...
</textarea>

Anyone Got any Ideas? The page/code that is giving me a headache is
here...
http://www.wperry.net/projects/codelib/detail.asp?id=19


Dim s
s = "code...code...code..." & vbCrLf
s = s & "code...<textarea></textarea>code..." & vbCrLf
s = s & "code...code...code..." & vbCrLf
s = Replace(s,"<","&lt;")
s = Replace(s,">","&gt;")
<textarea><%=s%></textarea>
Feb 4 '06 #3

Anthony Jones wrote:
<textarea>
<%=Server.HTMLEncode(varMyContent)%>
</textarea>

Anthony.


This is essentilaly what I am doing now. The problem is that when
varMyContent contains <textarea></textarea> the </textarea> closes the
textarea tag that is supposed to contain the code.

Feb 4 '06 #4

McKirahan wrote:
<wp*****@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I am writing a small database utility to catalog all of my favorite
ASM/JS/VBS... functions and scripts on an asp page. Everything is going
smoothly except for one thing that I can't quite seem to think my way
around.

I am using a <textarea> to display the code but some of my scripts have
<textarea> tags in them and when the </textarea> tag is entered, it
closes my <textarea> and the rest of the code ends up outside of the
textarea.

Example: (the code after the middle </textarea> show up outside of the
textarea box)

<textarea>
code...code...code...
code...<textarea></textarea>code...
code...code...code...
</textarea>

Anyone Got any Ideas? The page/code that is giving me a headache is
here...
http://www.wperry.net/projects/codelib/detail.asp?id=19


Dim s
s = "code...code...code..." & vbCrLf
s = s & "code...<textarea></textarea>code..." & vbCrLf
s = s & "code...code...code..." & vbCrLf
s = Replace(s,"<","&lt;")
s = Replace(s,">","&gt;")
<textarea><%=s%></textarea>


I though for sure that I would end up with the escape codes displayed
in the text area if I did it tis way but I read your post and decided
to try it. It works like a charm.

Thanks a lot.

Feb 4 '06 #5
Then you are doing something wrong.

<%
var = "<textarea> some stuff</textarea>"
%>
<form method=post action="">
<textarea name="" rows="20" cols="40"><%=server.htmlencode(var)%></textarea>
</form>

Bob Lehmann

"Will" <wp*****@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...

Anthony Jones wrote:
<textarea>
<%=Server.HTMLEncode(varMyContent)%>
</textarea>

Anthony.


This is essentilaly what I am doing now. The problem is that when
varMyContent contains <textarea></textarea> the </textarea> closes the
textarea tag that is supposed to contain the code.

Feb 5 '06 #6
Will,

Seriously, why are you not using Server.HTMLEncode ???

What happens if you code contains &? That also needs escaping.

Anthony.

Feb 5 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Hal Halloway | last post: by
4 posts views Thread by Simon | last post: by
reply views Thread by J. Muenchbourg | last post: by
1 post views Thread by Hans | last post: by
1 post views Thread by tranky | last post: by
2 posts views Thread by mattrapoport | last post: by
reply views Thread by lawrenceS59 | last post: by
reply views Thread by lawrenceS59 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.