Click to See Complete Forum and Search --> : [RESOLVED] How do i show the HTML for people to copy?


xedajx
11-29-2006, 05:13 AM
Hi, i've never posted here before, but recently i've had problems with finding the right code for my website. i want it to be possible for people to copy and paste a code for the banner of my site into their's. i've seen on other sites that they have little boxes which scroll down and you copy and paste the code (i can find you an example if you don't get what i mean, i'm not very good at explaining things). I did manage to sort one out which showed the html code of the banner in the box, but it didn't let me highlight it. the code i used was <showtext> or something. how can i get a box showing the html which allows me to copy the text?

Charles
11-29-2006, 05:20 AM
Use &lt; and &gt;.

xedajx
11-29-2006, 05:21 AM
where?

Charles
11-29-2006, 05:42 AM
Where ever you want a "<" or a ">" to appear. <code style="border:solid 1px #000; display:block; overflow:auto; padding:1ex; width:10em">&lt;a href="http://www.w3.org/"&gt;W3C&lt;/a&gt;</code>

abz
11-29-2006, 05:45 AM
or you could do:
<textarea>
This is the text for copying
</textarea>

Charles
11-29-2006, 05:52 AM
or you could do:
<textarea>
This is the text for copying
</textarea>That would however, be invalid. The TEXTAREA element takes PCDATA and not CDATA. http://www.w3.org/TR/REC-html40/interact/forms.html#edef-TEXTAREA

xedajx
11-29-2006, 05:56 AM
thanks that really helped. just one more problem - how do i get the text to wrap, so that it doesn't scroll across (only down)?

Charles
11-29-2006, 06:51 AM
Use my example, but be aware that the text will only wrap at whhite space characters. No spaces and you'll not get any wrapping.

xedajx
11-30-2006, 03:19 AM
ok, thanks guys.