How to Disable Web Page Form Elements
The following function for disabling web page Form Fields is written in Javascript. This function will be highly in demand when a developer wants to disable the form fields in a web page
Javascript Code to Disable Form Field
function DisableForm(myForm,cond){
var node_list = getElementById(myForm).getElementsByTagName('input');
for (var i = 0; i < node_list.length; i++) {
var node = node_list[i];
if (node.getAttribute('type') == 'checkbox' || node.getAttribute('type') == 'submit')
node.disabled = cond;
else node.readOnly = cond;
}
};