View Full Version : showing code?? without the &l; ...
darco9x2
07-16-2005, 05:12 AM
hi, is it possible to show code in html?
i thot it was with the <code></code> tag, but apparently that dosent work. any body know how to do it? i really dont want to have to use the & lt; and & gt; everytime. thanks.
jscheuer1
07-16-2005, 05:52 AM
The following demo shows two possible methods. Both require you to use the & named entity to show other named entities but, the rest of the code is literal:
<html>
<head>
<title>Show Code - Demo</title>
</head>
<body>
<textarea cols="140" rows="3" readonly style="font-family:arial;overflow:hidden;border:none;white-space:wrap;">
Hi, &nbsp; <table><tr><td><a href="#">Top</a></td></tr></table><br>The quick gray fox jumped over the slow brown dog.<br>&nbsp;<p align="center">Sally sells seashells down by the seashore</p>
</textarea>
<br>
<input type="text" readonly style="font-family:arial;border:none;" value="<br>&nbsp;<br>">
</body>
</html>
Note, however, that as long as you have <> where they shouldn't be, whether it shows or not, the page won't be valid.
My advice is to just run the code through a text editor's "replace."
jscheuer1
07-16-2005, 10:22 AM
That's got to be high on my list of reasons to [expletive deleted] the validator. Utter nonsense if true.
Not really... you have to consider HTML's XML background. An XML parser doesn't care what the tag actually does in an HTML page: all it sees is one tag inside another.
jscheuer1
07-16-2005, 01:20 PM
Fortunately browsers are still being coded with more common sense in mind than that.
mwinter
07-16-2005, 01:58 PM
Not really... you have to consider HTML's XML background.HTML has an SGML background, and as such it's slightly more forgiving than XML (and thus XHTML). The latter will not allow any literal occurances of < or & unless they begin an element or entity reference, respectively.
However, in this case, both SGML and XML require that < is escaped as < if followed immediately by a letter as that matches the grammar production for an opening tag. The content of a textarea element is described as PCDATA (parsed character data) and is sensitive to markup-like constructs.
Fortunately browsers are still being coded with more common sense in mind than that.They are being bloated with the code that is necessary to make them useful. That isn't a good thing in my opinion; it just encourages more junk. As Twey suggested, search and replace is your friend.
Mike
HTML has an SGML background
Oops... beggin' yer pardon. :o
That isn't a good thing in my opinion; it just encourages more junk.
I agree, and so does the W3C; that's what XHTML is all about.
jscheuer1
07-16-2005, 07:05 PM
We'll probably never agree on this, I'm just happy to see Mike is back! I was worried about you, old friend.
darco9x2
07-16-2005, 11:05 PM
thanks.
jscheuer1
07-17-2005, 10:42 AM
About your pics, I don't PM but, pretty impressive. The guns could use more detail and the third one, some work on contrast, in the darker area particularly. Is this ray trace?
darco9x2
07-17-2005, 02:31 PM
i think so, i just used render in 3ds. that pic with the gun, is unfinished since i know how to use bump now.
oh, and thanks.
mwinter
07-18-2005, 12:40 PM
We'll probably never agree on this,Probably not, no. :)
I'm just happy to see Mike is back! I was worried about you, old friend.After less than a week? Aww, I'm touched. :p :D
Fatigue. That's all.
Mike
jscheuer1
07-18-2005, 01:21 PM
After less than a week?It wasn't so much how long it had been but, when it happened.
mwinter
07-18-2005, 01:44 PM
It wasn't so much how long it had been but, when it happened.Oh, I see. :eek: I live in the South West region, not London.
Mike
jscheuer1
07-18-2005, 02:48 PM
I live in the South West region, not London
It just says UK on here. I was thinking that it wasn't until a day or so after but wasn't sure. The odds of one person getting involved in something like that are very small compared to so many other daily tragedies that we take for granted like car accidents but, it gave me pause. I thought perhaps you or a family member was at least affected in some way and that it could be related. Just relieved you are back, I know what you mean about fatigue at times. This can be such an addiction.
darco9x2
07-20-2005, 02:29 AM
oh, took me a while to figure out what you were talking about. glad to hear you're ok. (didnt know you were in teh uk...)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.