473,396 Members | 1,843 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.

disabling text boxes

10
hi all,

i've five text boxes followed by a check box ..... when i check the checkbox it shud disable all the text boxes.... when i uncheck it the vice-versa shud happen..

how do i do it???? help me out of dis



Thanx
Jul 23 '07 #1
7 1385
gits
5,390 Expert Mod 4TB
hi ...

welcome to TSDN. onclick of your checkbox you have to call a function that loops through the textboxes and set/remove the disabled attribute of them. please post some code you have done so far ...

kind regards
Jul 23 '07 #2
harig
10
thank u ... i've done dis already.....


Expand|Select|Wrap|Line Numbers
  1. if(document.getElementById("sameKwd").checked){
  2. for(var i=0;i<=10;i++){
  3.         document.getElementById("keyword"+i).disabled = true;
  4.         }
  5. }
but am getting dis error :

document.getElementById("keyword" + i) has no properties
Jul 23 '07 #3
gits
5,390 Expert Mod 4TB
do you have the ids 'keyword0' ... 'keyword10' in your document?

have a look at the following example:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <script>
  3.     function toggle_tb_state(state) {
  4.         for (var i = 1; i <= 4; i++) {
  5.             var tb = document.getElementById('keyword'+i);
  6.  
  7.             if (state) {
  8.                 tb.setAttribute('readonly', 'true');
  9.             } else {
  10.                 tb.removeAttribute('readonly');
  11.             }
  12.         }
  13.     }
  14.     </script>
  15.     <body>
  16.         <input type="text" id="keyword1"/>
  17.         <input type="text" id="keyword2"/>
  18.         <input type="text" id="keyword3"/>
  19.         <input type="text" id="keyword4"/>
  20.         <input type="checkbox" onclick="toggle_tb_state(this.checked);"/>
  21.     </body>
  22. </html>
  23.  
kind regards
Jul 23 '07 #4
harig
10
thanx a lot... i've got de answer......
Jul 23 '07 #5
gits
5,390 Expert Mod 4TB
thanx a lot... i've got de answer......
come back when you have more questions ;) ... anytime ...

kind regards
Jul 23 '07 #6
harig
10
hey am back.......can we do directory browsing using javascript.?????
Jul 23 '07 #7
gits
5,390 Expert Mod 4TB
hey am back.......can we do directory browsing using javascript.?????
;) ... that's a question besides the original problem ... so you normally should create a new thread for this. but the answer to this one is simple: you cannot! imagine a website that may retrieve the contents of any folder on you machine ... fortunatly this is not possible ;) ...

kind regards
Jul 23 '07 #8

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

Similar topics

1
by: Fawke101 | last post by:
Hi there, I have a .asp page that has a text box and a list box. The user enters criteria into ONE of the boxes. What i would like is that when the user makes a selection from the list box...
2
by: Don | last post by:
is there any way to disable the controls on a form without changing their appearance? i would like to make it impossible for a user to click buttons and edit text boxes while the controls retain...
2
by: Gary | last post by:
Hello All, I have an editable data grid in my web form, this grid allows the user to add new records, edit existing records and also delete them. When a user adds a record the grid goes in to...
2
by: Andy Fish | last post by:
Hi, I have one textbox on the form that needs to have ValidateRequest disabled, but it seems that it can only be enabled/disabled at a page level. assuming I have to disable it at for the...
7
by: John Meyer | last post by:
I have a program where I have to enable or disable a list box based upon a radio button. Is there an "enabled" property on select boxes?
11
by: Edson Peacock | last post by:
I have a report with sub reports, one of the subreports have 12 text boxes that are 2" high and I want them all to grow if one goes to 3" high. If anyone has any suggestions they are very much...
5
by: KingKen | last post by:
I have created a form with a few tabs for data entry. The first tab contain fields that i want to disable after data is entered and saved. that is a person comming after to enter data into that form...
1
by: Albin | last post by:
Hi, I have a form in which i have two text boxes one for entering email and the other for verify email (to make sure the user entered the correct email id we are asking to enter the same email id...
5
by: jehugaleahsa | last post by:
Hello: I am sure this question comes up a lot. I need to disable the controls on my Windows forms so that when the BindingSource is empty some the controls bound to it will be disabled. This...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.