Home > Web Front-end > JS Tutorial > javascript Hide/show the specified area with HTML element [legend] usage_javascript skills

javascript Hide/show the specified area with HTML element [legend] usage_javascript skills

WBOY
Release: 2016-05-16 18:33:05
Original
1409 people have browsed it

javascript code:
Code

Copy code The code is as follows:

function expandOther(el, el2) {
whichEl = document.getElementById(el)
button = document.getElementById(el2)
if (whichEl.style.display == 'none') {
whichEl.style.display = '';
button.value = "Hide";
}
else {
whichEl.style.display = 'none';
button.value = "Show";
}

expandOther(e1,el2),
e1 parameter can specify the event object that needs to be operated, such as an Input button with the ID inputshowData,
el2 parameter can specify the event object that needs to be hidden A region, which can be TABLE, div, etc.

id is datadiv data Display layer area
id is inputshowData operation button
HTML sample CODE:
Copy code The code is as follows:
















Did you find it very simple?
Personally.
However, this layer has scroll bars, mainly based on the style attribute overflow:auto; and the specified width and height.
If the width is not specified directly, the scroll bar will be displayed based on the width of the browser.
If the height is not specified, the downward scroll bar will not be displayed, as it seems. I'm not good at art. I will record it here today, so I can look back and see how I understood and wrote the code at that time.
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