Home >Web Front-end >HTML Tutorial >JS implements method of locking HTML page elements when loading

JS implements method of locking HTML page elements when loading

不言
不言Original
2018-06-05 15:16:162088browse

This article mainly introduces the JS method of locking HTML page elements when loading, involving JavaScript's implementation skills related to traversal and attribute operations of page elements. Friends in need can refer to the following

The examples of this article are described JS implements the method of locking 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;)
}

Related recommendations:

js method to get the value of the span tag in html (super simple)

The above is the detailed content of JS implements method of locking HTML page elements when loading. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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