473,396 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to make the textbox become unchangable..

102 100+
beginner here..hahahha...

how can i change the textbox become unchangable ar>??? can see but cannot change...
Jun 20 '07 #1
4 1933
gits
5,390 Expert Mod 4TB
hi ...

use:

Expand|Select|Wrap|Line Numbers
  1. var textbox = document.getElementById('your_textbox_id');
  2.  
  3. // to make it readonly
  4. textbox.setAttribute('readonly', 'true');
  5.  
  6. // to enable it
  7. textbox.removeAttribute('readonly');
kind regards ...
Jun 20 '07 #2
lyealain
102 100+
hi ...

use:

Expand|Select|Wrap|Line Numbers
  1. var textbox = document.getElementById('your_textbox_id');
  2.  
  3. // to make it readonly
  4. textbox.setAttribute('readonly', 'true');
  5.  
  6. // to enable it
  7. textbox.removeAttribute('readonly');
kind regards ...
sorryy.. my javascript suck...!!!

i put
<head>
<script language="javascript">
var textbox = document.getElementById('Part');

textbox.setAttribute('readonly', 'true');

</script></head>


my textbox name=Part and id= part

why i cant get the readonly result
Jun 20 '07 #3
gits
5,390 Expert Mod 4TB
... wrap it in a function and call it onload of your body ... this will work ;)

in case you want to have the textbox always readonly then you may do:

[HTML]<input type="text" name="whatever_name" id="whatever_id" readonly="true"/>[/HTML]

this works too ... ! in case you want to enable it during runtime ... call a function that removes the attribute the way i showed you ...

kind regards ...

explaination: onload of the document's body all elements are already rendered by the browser engine and then you may refer to them using javascript ... the way you did javascript should throw an error from getElementById() ... have a look at the js-console
Jun 20 '07 #4
lyealain
102 100+
thank you very much,.... i am new but granted a proj in javascript...hahah...

can u help me on this quetions...

let say i have 100 textbox and i update 10 out of that ... how do i display those only updated textbox with color??...thanks

-------------------------------------------------------------------------------------------------------------
function foo(){
document.getElementById('test').className='input2'
}

</script>
<style type=text/css>
.input {background: #ff2345; }
.input2 {background: #987654; }

</style>


<input class=input id=test type=text>
<a href=javascript:foo()>click here</a>
=------------------------------------------------------------------------------------------

they told me to do in this way.. but when i click on my update button.. it will actually go to another page to get the update function before redirect to this page ... how i show only updated textbox with color
Jun 20 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Imaya Kumar | last post by:
Hi, i'm developing an editor in VS.NET using Rich Text Box Control. I need to make a selected text Bold. how can i do this? also i will have an Italic Button too. If i click Bold button the...
4
by: Albinas | last post by:
Hi all, I am trying to customize the text box to suit the practice of my app. And I am working about the focus behavior of text field. I have met the the following problem. When I set the...
2
by: simon | last post by:
hello, new to vb.net, have a few questions about DataGrid. I have a dataGrid that is working pulling a dataset back from a stored proc and binding to the datagrid for display the datagrid's...
2
by: Eniac | last post by:
*argh* ... *pull hairs* I've recently started developing from ASP to ASP.NET The switch was fairly smooth since i had done some VB.net before ... then came...FORMS! :) I find it astounding...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
2
by: dougloj | last post by:
Hi. I have an ASP.NET application written in C#. To log in, a user must provide their email address and password. I already give the user a "Remember my Email Address" check box. If they check...
18
by: active | last post by:
Console.WriteLine(String.Equals(s, s.Clone.ToString)) s is type string. This returns True. If Clone really made a new copy I'd expect False.
2
by: JLC | last post by:
Hi, I am creating a page in asp.net that has a checkbox and a textbox. When the checkbox is checked I want the textbox to become active and show text. If the checkbox is unchecked, I would like...
0
by: Ronald S. Cook | last post by:
Stupid question for the day but weirdly I don't have this yet. How can I format a textbox such that if the user enters a number like 4 it will become (on validated) 4.00. If they enter 5.1 it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.