Home > Web Front-end > JS Tutorial > js sample code to make all elements of a FORM form uneditable_javascript tips

js sample code to make all elements of a FORM form uneditable_javascript tips

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 17:19:44
Original
1299 people have browsed it
Copy code The code is as follows:

//Make the page uneditable
function disableOcx() {
var form = document.forms[0];
for ( var i = 0; i < form.length; i ) {
var element = form.elements[i];
// Some elements can be numbered. element.name is a custom name for the element
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;//Execute this function when the page is loaded

//Cancel uneditable
function noDisable() {
var form = document. forms[0];
for ( var i = 0; i < form.length; i ) {
var element = form.elements[i];
element.disabled = false;
}
}
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Where is js written?
From 1970-01-01 08:00:00
0
0
0
js file code not found
From 1970-01-01 08:00:00
0
0
0
js addClass not working
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template