Disable Web Page Form Elements

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;

Related Topic HTML XHTML Basic Structure and Elements
What are all the Versions of HTML and XHTML
Struts 1 vs Struts2 Difference Performance
Servlet Interview Questions & Answers
JSP Interview Questions & Answers

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback