Jump to content
xisto Community
kilz

disable html tags

Recommended Posts

<pre>
<p>lalalalalal</p>
</pre>

will show:

<p>lalalalalal</p>

rather than:

lalalalalal

 

I think that's what you need?

Share this post


Link to post
Share on other sites

I want to display the html code, also disable their function.

for example:

if I type: <b>fjdsgfjds</b>

output = fjdsgfjds

!= fjdsgfjds

 

but I don't want any php or javascript code. . .

Share this post


Link to post
Share on other sites

then, there's no such thing. you'll have to use either a client or server side script. i'd advise php, because then your output doens't depend on the client having javascript enabled or not. but javascript is probably the easiest.

http://forums.xisto.com/no_longer_exists/

that should help you out

but i'd still advise you to use php though, or another serverside script.
+ i don't really get the use but whatever

Share this post


Link to post
Share on other sites

I want to display the html code, also disable their function.

for example:

if I type: <b>fjdsgfjds</b>

output = fjdsgfjds

!= fjdsgfjds

 

but I don't want any php or javascript code. . .

<{POST_SNAPBACK}>

How does that display the html code...? :/

Share this post


Link to post
Share on other sites

How does that display the html code...? :/

sorry, it should be: <b>fjdsgfjds</b>

save your file as text, the server wont parse that as html.also try "<" it will show < and ">" show > in html.
for example.
<B> This is not bold </B>
output:
<B>This is not bold</B>

hope that helps

thanks a lot, but please tell what it means, < >
are they ascii code of < and >??

-------------
in php, we can use htmlspecialchars() to display and disable html.
in javascript, how??
I would like to create some html tutorial for my site, so disable them.

Share this post


Link to post
Share on other sites

ok, i really don't get your question anymore, but whatever:

normal situation:

if your code is: <b>bold</b>

they will see bold

1. if you want the users to see your html code instead of the effect it has, use <pre>

 

your code: <b>bold</b>

on their screen: <b>bold</b>

 

another option to do this is the way r3d described: you use the html special characters instead of the real character.

you can make a javascript function that replaces every "<" by "<", every

">" by ">" etc

 

2. if you want to strip all the tags:

your code: <b>bold</b>

they see: bold

 

what you need to do is strip the html tags

so wherever you find something like <xxx> (regular expression: /<[^>]*>/) replace it by an empty string.

 

 

if this still doesn't help you, please tell us which one of these two things you want.

Share this post


Link to post
Share on other sites

wasnt this solved in the first reply by lhunath? being as it was the right answer. at least in my mind it was.

Share this post


Link to post
Share on other sites

wasnt this solved in the first reply by lhunath? being as it was the right answer. at least in my mind it was.

<{POST_SNAPBACK}>

That's what I thought, but what the heck, if they want to go and replace all < with < 's and > with > 's, then fine with me; I won't be the one writing it :)

Share this post


Link to post
Share on other sites

in php, we can use htmlspecialchars() to display and disable html.

in javascript, how??

I would like to create some html tutorial for my site, so disable them.

<{POST_SNAPBACK}>


eerrrr don't do this, don't use js or php to disable html code. once you did this, is just like opening a door to a script kiddies :)

just use html entities e.g. < = <, &gt = >, © = Š and soon...

html entities whon't envote any markup it just kind a replacement...

Share this post


Link to post
Share on other sites

The cleanest way to go about doing this would be :>> Use Javascript to write a parser (its going to be tough)>> Use server side scripting.But anyway, what do you want this for ???

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.