Forum Moderators: open

Message Too Old, No Replies

select text and putting code into a textbox

         

th1chsn

4:46 pm on Oct 6, 2005 (gmt 0)

10+ Year Member



I'm having trouble figuring something out and I was hoping someone might be able to help.

I want to include html code inside a textbox and have a link "Select All" that selects the contents of the form.

When I put in the html code the page rendered funny as if its trying to interpret the form contents as code.

Does anyone know how to put code into a text box and how to create a select all function?

lobo235

4:54 pm on Oct 6, 2005 (gmt 0)

10+ Year Member



Things like the angle brackets used in HTML must be converted to < and > html entities. If they are not then you might see problems like yours. As far as the select all button goes, there should be something useful if you search google.

Bernard Marx

5:54 pm on Oct 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<textarea id="codearea" name="codearea" rows="10" cols="15">This is &lt;html&gt; </textarea>
<button onclick="document.getElementById('codearea').select()">Select</button>

th1chsn

6:37 pm on Oct 6, 2005 (gmt 0)

10+ Year Member



Thanks guys. That worked perfectly!