js 使FORM表单的所有元素不可编辑的示例代码
代码如下:
//使页面不可编辑
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;
}
} 相关推荐
Qc 2020-07-19
swiftwwj 2020-07-05
wcqwcq 2020-07-04
TONIYH 2020-06-11
yhginny 2020-04-20
nicepainkiller 2020-05-12
苦咖啡flask 2020-05-09
xinjing0 2020-05-08
Lius 2020-05-05
ajaxtony 2020-05-04
bcbeer 2020-04-23
sicceer 2020-04-20
cmsmdn 2020-02-18
longshengguoji 2020-02-13
ajaxtony 2020-02-03
ELEMENTS爱乐小超 2020-01-17
waterv 2020-01-01