Click to See Complete Forum and Search --> : lock text box
Hello,
I am very new to javascript and I am stumbling along. I have a text box that is hidden when the page loads and only shows after the user has clicked a button. I have this part working fine. My problem is after adding a style sheet to the text box. I wanted the use of the text box because of limited room for the text so this is why I did not use a label. I used the css to get the background to the text box black and text to show up white. My problem now is that the user for some reason has the capability to edit the text from the webpage. Do I need to lock this somehow. This is the first time I have had this problem.
Also, Is there a way with Javascript to remove the scroll bars on a text box if they are not needed?
Thanks for you help,
eg8r
AdamGundry
05-10-2003, 04:49 PM
You'd be better off using a <div> tag, then using CSS to customise it as you need. For example:
<div style="width: 100px; height: 100px; overflow: auto">
This will give a 100px square area which will display scrollbars for content if required.
Adam
Charles
05-10-2003, 04:49 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<textarea cols="40" rows="20" readonly="readonly" onfocus="this.blur()" style="overflow:auto">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipitlobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor *** soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.</textarea>
Thank you for the readonly code. I never even thought about that.
As for the div tag. I am not familiar with this. Here is my code in the css....
.txtinfostyle {
font-size: 22px;
color: #FFFFFF;
background-color: #000000;
border: #000000;
}
Can all this be added in just the way it is. Also, do i need to do anything different to the actual text box. I guess my other question is where, do I put the div tag.
eg8r
Also, is there any advantage to using the div over css as a rule of thumb?
eg8r
Charles
05-10-2003, 05:37 PM
You've got a biger problem than that. One in ten users do not use JavaScript. To keep you page working for those folks you'll need to start the text readable, make it unreadable with JavaScript and then make it readable again.
I guess what you are saying is that I need to have some code the first checks to see if the user is using javascript. If so, then run what I have, else show the text box.
correct?
eg8r
Charles
05-10-2003, 06:15 PM
No, I'm saying that you need to start with a page that works just fine without any JavaScript at all. Then you use JavaScript to add the bells, whistles and fuzzy dice.