Highlight Textarea

Here is the textarea box I used on this site to display source code.

Highlight The Source Code Below

<form name="a">Highlight The Source Code Below<br>
<textarea name="txt5" wrap="physical" rows="5" cols="47" readonly="readonly">

Click on the button below to highlight this text.

</textarea><br><input type="button" value="Highlight All" onclick="javascript:this.form.txt5.focus();this.form.txt5.select();">
</th></tr></table>
</form>

Highlight The Source Code Below

Above you'll notice txt5. To use multiple textareas on one page with highlight buttons change the number on the end of txt5 to a different one. Such as txt4 or txt3 etc. Make certain that the name in the textarea and the highlight button input match exactly or it will not function.

TIPS: When displaying HTML or JavaScrpipt source code in a textarea box like this you do not need to convert the "<" to &lt; or &#60; except for the textarea tag. The textaraea tag must be converted or it will try to make HTML. Also, &nbsp; must have "amp" between & and n to keep it from trying to make a space. Don't worry the "amp" won't be seen by your viewers unless they look at your source code. If you want any special character numbers such as &#64; or &#255; to appear in this textarea you must also put "amp" between & and # (like this &amp64; or &amp255;) or they will try to turn themselves into their corresponding characters.

Above you see &amp64; and &amp255;. The reason you can see "amp" between & and # is because there are two "ampamp" in there. There is always one "amp" you can't see without looking at the sorce code of the page.



<<< Back



Home Page       This Page Was Last Updated: