jsがFORMフォームのすべての要素を編集できないようにするコード例

1171 ワード

 
  
//
function disableOcx() {
var form = document.forms[0];
for ( var i = 0; i < form.length; i++) {
var element = form.elements[i];
// element.name name
if (element.name != "auditEntity.auditContent"
&& element.name != "auditEntity.auditAutograph"
&& element.name != "auditEntity.auditTime"
&& element.name != "auditEntity.auditState"
&& element.name != "submitBtn"
&& element.name != "reset"
&& element.name != "id"
&& element.name != "processInstanceId"
&& element.name != "updateForm") {
element.disabled = "true";
}
}
}
window.onload = disableOcx;//

//
function noDisable() {
var form = document.forms[0];
for ( var i = 0; i < form.length; i++) {
var element = form.elements[i];
element.disabled = false;
}
}