Forums

ASP

This topic is locked

Display code

Posted 29 Jan 2002 15:47:21
1
has voted
29 Jan 2002 15:47:21 Viktor Farcic posted:
I'm stuck with deadline and, as it usually happens, my brain stoped working.
How can I preserve code from being processed in browser?
If I write something like:
<b>This text should be bold</b>
<pre id=code><font face=courier size=2 id=code>&lt;b&gt;This text should be displayed as it is&lt;/b&gt;</font id=code></pre id=code>

I want text between special signs (for example [code]) to be displayed as it is writen.

Viktor Farcic

TalkZone Manager

Replies

Replied 30 Jan 2002 15:18:52
30 Jan 2002 15:18:52 Owen Eastwick replied:
Think I've got it.

To display

&lt;b&gt;This text should be displayed as it is&lt;/b&gt;

in the browser use this;

& lt;b & gt; This text should be displayed as it is & lt;/b & gt;

So basically you need to replace all the &lt; with & lt; and all the &gt; with & gt;

NOTE: I've added a space between & and lt; etc.

So you could set up some JavaScript or VBScript to look through the input for all the HTML tags you want to leave in.

Replace "[code]&lt;b&gt;" with & lt;b& gt;
Replace "[code]&lt;/b&gt;" with & lt;/b gt;

etc..

Does that help?


Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo

Edited by - oeastwick on 30 Jan 2002 15:32:19
Replied 01 Feb 2002 04:42:04
01 Feb 2002 04:42:04 Owen Eastwick replied:
Did you get it working?

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 01 Feb 2002 10:03:06
01 Feb 2002 10:03:06 Viktor Farcic replied:
I know about things you wrote. The problems is that I want to replace '&lt;', '&gt;' and some other signs only if they are inside of some special tags (let's say [scode]...[/scode]).
Imagine that this text is stored in DB:
&lt;b&gt;&lt;i&gt;This text is bold and italic 'couse there are no special tags&lt;/i&gt;&lt;/b&gt; and then I want to display something ignoring html commands by placing those tags at the begining and the end.[scode]&lt;b&gt;&lt;i&gt;This text ISN'T bold and italic 'couse there ARE special tags. It's displayed as it is.&lt;/i&gt;&lt;/b&gt;[/scode]

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Did you get it working?

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Viktor Farcic

TalkZone Manager

Edited by - vfarcic on 01 Feb 2002 10:03:48

Edited by - vfarcic on 01 Feb 2002 10:04:44

Reply to this topic