Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display HTML Key Words

Status
Not open for further replies.

Brig

MIS
Mar 14, 2000
5
US
How do I display HTML keywords to show examples.
For instance I want to say, This is the proper way to write a submit button. "code for submit button goes here".
But everytime I try, the browser traslates my "example code to a real submit button so no one ever sees the code.
I know about "<" and ">" but is there a easier way to tell the browser...don't translate this next line?
or in other words

When I do this...
<PRE>
<Example code>
<More example Code>
</HTML>
</PRE>
That little </HTML> gets translated. And the document ends before I want it too.
I can't use &amp;lt; or &amp;gt;

any other suggestions
 
sorry pal, looked around for a 1/2 hour or so, best I could do was write this little tool for you:

<html>
<head>
<title>Untitled</title>
</head>

<body>
<script>
function trans(obj)
{
var reg1,reg2,newval
reg1 = /</g;reg2 = />/g
obj.value=obj.value.replace(reg1,&quot;&amp;lt&quot;).replace(reg2,&quot;&amp;gt&quot;)
}
</script>

<textarea id=&quot;benluc&quot; style=&quot;width:500px;height:500px;border:1px solid black;color:navy;font-family:verdana;font-size:9pt&quot;>

</textarea>
<br>
<button style=&quot;position:relative;left:400;font-family:verdana;font-size:9pt;border:1px solid black;cursor:hand;width:100px&quot; onClick=&quot;trans(benluc)&quot;>Transform</button>
</body>
</html>

works in IE only (probably 4+, but I tested with 5.5). Just put your code in the box and click transform. jared@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top