An HTML Form has one textbox & one checkbox. I want that if the checkbox is checked, the textbox should be made read-only but if the checkbox is unchecked, the textbox should be made editable. How do I do this using JavaScript?
Actually the textbox gets populated with a value from the database (for which I am using ASP). If the value is 12:00 AM, then the textbox should be read-only & the checkbox should be checked. If the database value is something other than 12:00 AM, then the textbox should be made editable & the checkbox should be unchecked. Next if the user again checks the checkbox, then again the textbox should be made read-only with whatever value that has been entered by the user. I can take care of the comparisons of the database value with 12:00 AM & all those stuff;that's not a problem.I just want the JavaScript code which will make the textbox read-only or make it editable depending on the state of the checkbox.
Thanks,
Arpan
Actually the textbox gets populated with a value from the database (for which I am using ASP). If the value is 12:00 AM, then the textbox should be read-only & the checkbox should be checked. If the database value is something other than 12:00 AM, then the textbox should be made editable & the checkbox should be unchecked. Next if the user again checks the checkbox, then again the textbox should be made read-only with whatever value that has been entered by the user. I can take care of the comparisons of the database value with 12:00 AM & all those stuff;that's not a problem.I just want the JavaScript code which will make the textbox read-only or make it editable depending on the state of the checkbox.
Thanks,
Arpan