Home > Web Front-end > JS Tutorial > Use javascript to disable all text boxes, drop-down menus, and multi-line text fields on the web page_javascript skills

Use javascript to disable all text boxes, drop-down menus, and multi-line text fields on the web page_javascript skills

WBOY
Release: 2016-05-16 17:09:05
Original
1172 people have browsed it

The principle is to loop through the controls on the web page, and then set the disabled attribute to true.

The code is as follows:

Copy the codeThe code is as follows:



The following are the types of these controls:

Can be obtained through document.getElementsByName("controlName")[0].type.toLocaleLowerCase().

There are the following types according to different controls:
"text"
"textarea"
"select-one"
"select-multiple"
"radio"
"checkbox"

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