File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes disable text box and a label Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "disable text box and a label" Watch "disable text box and a label" New topic

disable text box and a label

Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
Im disabling a text field using javascript. but i wanted to know if there was anyway to change the color of the label too. it's a <TH></TH> and has a style class for it(both gray and black).

i want to change this dynamically depending on a drop down. i can change disable field. but dont know how to change label color

[ August 19, 2005: Message edited by: mannu kapoor ]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60808

Change the colors using CSS.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
ya but how would i switch between black and gray when i switch values on the drop down washes.
Niki Nono
Ranch Hand

Joined: Mar 20, 2005
Posts: 256
you can use
document.FORMBNAME.ELEMENTNAME.className = "the new style you want"
The new style should be present in your stylesheet.

If you are changing for the TH then you will have to give the TH an ID and then using document.getElementById("TH's ID").className = "the new style that you want".

hope this answers your question.

Life called,so here I am.<br />Cheers<br />Niki.:-)
Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
that helps thank you. did not know how to call the css class with javascript
wood burning stoves
subject: disable text box and a label
Similar Threads
Converting an application using xstl from struts to struts 2
How to increase the colum width
How would you improve this code?
A question of Sums
Fixed Table Header and changing classes