Forum Moderators: open
<textarea id="testtext" style="width:600px;height:500px">
<% & %>
<! & !>
< & >
&
</textarea>
and explain to me why (in IE) it displays literally when between the <%ASP%> tags and as an entity elsewhere? It also does the same if you put it in comment tags <!-- & -->.
Any ideas? I'm reluctant to write a script that checks whether it's inside ASP tags, could end up being a real nightmare.
It shouldn't be, client side VBScript is marked up just like JScript:
<script type="text/vbscript">...</script>. ASP tags <% are purely for server scripts.
I've now used Server.HTMLencode() (in ASP on the server) on the entire contents of the textarea and it works a treat. I'm guessing that, strictly speaking, you should never have a <, > or an & inside <textarea> tags, so if they start behaving oddly you know where to look.
Does anyone know if this assumption is correct? Should your <input type="text" value="value"> value be HTML encoded too?