復制代碼 代碼如下:
//使頁面不可編輯
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;
}
}