How to prevent user from deleting text in a text box.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Realty King
    New Member
    • Feb 2010
    • 1

    How to prevent user from deleting text in a text box.

    Ok so I am new here and was wondering if someone a little more advance then me can help me out.

    I have text box on my website with code for user(s) to copy the code that's in the text box and paste the code in Orkut scrapbook which will generate a imagine.

    Here is example of code:

    <TEXTAREA name="textarea2 " style="WIDTH: 300px; HEIGHT: 55px" onclick=this.focus();t his.select()><c enter><a href="http://www.sample.com" ><img src="http://.photobucket.co m/albums/.gif" title="title" border="0"></a><br><center>< a href='http://www.sample.com" '><font size="2"> Graphics - </font></a></center></center>
    </TEXTAREA>

    As you can see from the tags, I am using onclick so when user clicks on code it highlight it and then they can copy.

    The problems is that you can delete or remove text from within box, if your not careful.

    I DONT want the user to be able to delete code in text box. How can I prevent this from happening without removing the onclick scrip.

    Please if you could when reply maybe include the sample code above and highlight the new added code so I can see where to make my changes.

    I hope I explained this well for anyone to understand!
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Please post your questions to the relevant forum. As you can see, this has little (nothing) to do with Java.

    Anyway, see the readonly attribute for textareas.

    Comment

    Working...