Javascript hide/show the specified area with HTML element [legend] _ javascript tips

Source: Internet
Author: User
Tags html sample
Write JS when you are busy today to show hidden DIV areas. Javascript code:
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 = "hidden ";
}
Else {
WhichEl. style. display = 'none ';
Button. value = "alarm ";
}


ExpandOther (e1, el2 ),
The e1 parameter can specify the event object to be operated, for example, an Input button with the ID of inputshowData,
The el2 parameter can specify a region to be hidden, such as TABLE and p.

Id is the data display layer area of datap.
The id is inputshowData.
HTML sample CODE:

The Code is as follows:


















Is it easy to find?
I personally think.
However, this layer has a scroll bar, mainly based on the style Attribute overflow: auto; and has a specified width and height.
If the width is not directly specified, the scroll bar is displayed based on the browser width,
If the height is not specified, the scroll bar is not displayed. I am not good at art artists. The privilege is recorded here today. You can look back and see how you understood and wrote the code at that time.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.