The principle is to loop through the controls on the Web page, and then set the Disabled property to true.
The code is as follows:
Copy Code code as follows:
<script type= "Text/javascript" >
var nodelist = document.getelementsbytagname ("input");
for (var i = 0; i < nodelist.length; i++) {
Nodelist[i].disabled = true;
}
NodeList = document.getElementsByTagName ("select");
for (var i = 0; i < nodelist.length; i++) {
Nodelist[i].disabled = true;
}
NodeList = document.getElementsByTagName ("textarea");
for (var i = 0; i < nodelist.length; i++) {
Nodelist[i].disabled = true;
}
</script>
The following are the types of these controls:
can be obtained by Document.getelementsbyname ("ControlName") [0].type.tolocalelowercase ().
There are several types of controls depending on their differences:
"Text"
"TextArea"
"Select-one"
"Select-multiple"
"Radio"
"checkbox"