Solved

HTML text area uneditable

Posted on 2007-12-04
5
926 Views
Last Modified: 2013-12-13
ok so i need a text area in an html file that contains text that cannot be edited. kinda like what you see when you agree to terms and conditions then check a box that says i agree, then you proceed to login or signups.....
0
Comment
Question by:bcmeyer1983
5 Comments
 
LVL 20

Accepted Solution

by:
steelseth12 earned 125 total points
ID: 20406957
<textarea readonly name="mytext">text here</textarea>
0
 
LVL 36

Assisted Solution

by:Zyloch
Zyloch earned 125 total points
ID: 20406972
In fact, both the readonly and disabled attributes would work in your case, since it doesn't really matter if the terms text is sent with your form. Therefore, you can also do

<textarea name="mytext" disabled>text here</textarea>
0
 
LVL 2

Author Comment

by:bcmeyer1983
ID: 20406987
what does this to to it:
onFocus="this.blur()
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 20407004
That is Javascript code that will not let the user click into the field. It could be used to imitate readonly behavior (because readonly is subtly different from disabled) in extremely old browsers.

Nowadays, do not use something like that. It is Javascript, and many users have Javascript disabled. It can be done with the attributes steelseth and I have given you, so there is no need for it. (There may be other ways around the Javascript as well, but the attributes are pretty much foolproof).
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 20407044
try this
<script type="text/javascript">

function setRead(bool) {
   if(bool) {
      document.getElementById("ta").readOnly = true;
   }
   else {
      document.getElementById("ta").readOnly = false;
   }
}

</script>

<textarea id="ta"></textarea>
<input type="checkbox" onclick="setRead(this.checked)" />
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now