Home > Web Front-end > JS Tutorial > Detailed explanation of JS implementation of locking HTML page elements when loading

Detailed explanation of JS implementation of locking HTML page elements when loading

零下一度
Release: 2017-06-27 15:33:16
Original
1233 people have browsed it

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(&#39;input&#39;).length;z++)
{
 document.getElementsByTagName(&#39;input&#39;)[z].setAttribute(&#39;disabled&#39;,&#39;disabled&#39;)
}
for(zz=0;zz<document.getElementsByTagName(&#39;textarea&#39;).length;zz++)
{
 document.getElementsByTagName(&#39;textarea&#39;)[zz].setAttribute(&#39;readonly&#39;,&#39;readonly&#39;)
}
for(zzz=0;zzz<document.getElementsByTagName(&#39;select&#39;).length;zzz++)
{
 document.getElementsByTagName(&#39;select&#39;)[zzz].setAttribute(&#39;disabled&#39;,&#39;disabled&#39;)
}
Copy after login

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!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template