|
You may have noticed around the Bravenet site that whenever you want you to copy code from a text area they provide you with a button that will highlight all of the code for you to copy and paste onto your website. Well i thought i will share that code snippet with you as it can be very handy.
This is how to code the feature:
<form name="copyThis">
<textarea name="codeToCopy" cols="40" rows="5" readonly="readonly">
Click on the button below to highlight this text.
</textarea>
<br>
<input type="button" value="Highlight All" onclick="javascript:this.form.codeToCopy.focus();t his.form.codeToCopy.select();">
</form>
Copy the code and paste the code between the <body> and </body> of your HTML document.
Remember that if you would like to have several different highlightable text areas on the same page you will have to change the 'name' of the text area and ensure that the new name is replaced in the 'onclick' event of the button.
In addition, it is not a bad idea to get in the habit of replacing all tags within the text area with special characters to avoid the code in the text area from interfering with the html displaying your page. The special character for an opening tag '<' is < and a closing tag '>' is >.
Written by Bravenet.com, Changed my Rogem for forum use and more easy reading.
__________________
PHP Code:
Add_Talkupation('rogem002'); // Because sharing is awesome!
|