This article mainly introduces the JS method of locking HTML page elements when loading, involving javascriptTraversal of page elements and Attribute operationRelated implementation skills, friends in need can Refer to the following
The example of this article describes the method of JS to lock HTML page elements when loading. Share it with everyone for your reference, the details are as follows:
When the html is loaded, js locks all input, textarea, and select in the page. The specific js is as follows
index.js
for(z=0;z<document.getElementsByTagName('input').length;z++) { document.getElementsByTagName('input')[z].setAttribute('disabled','disabled') } for(zz=0;zz<document.getElementsByTagName('textarea').length;zz++) { document.getElementsByTagName('textarea')[zz].setAttribute('readonly','readonly') } for(zzz=0;zzz<document.getElementsByTagName('select').length;zzz++) { document.getElementsByTagName('select')[zzz].setAttribute('disabled','disabled') }
The above is the detailed content of Detailed explanation of JS implementation of locking HTML page elements when loading. For more information, please follow other related articles on the PHP Chinese website!