JavaScript Practical Tips-Implementing columns Display

Source: Internet
Author: User

Remember to Brother Siang the test system, see their test page can be implemented to hide the left side of the examinee information part, at that time feel good tall on, good humanization. Now that I've learned JavaScript, I can do the same, and show off.

1. Page Design:


(1). html code:

<title>js Sub-column </title><style type= "Text/css" >.alignment{text-align:center;} </style>

(2). Description: In fact, this page is very simple, just a row of three columns of the table. The first part puts the column name, the third part is the main content . The middle part put a picture of the Left (right) arrow, previously thought more, thought is a very cow control.


2.javascript Code:

<script language= "javascript" type= "Text/javascript" >function Hide ()//Click the left arrow to hide the section {// The first step: Hide the column list document.getElementById ("Lanmu"). style.display= "None";//Second step: Change the arrow image at the same time, The left arrow responds with an event that shows show () document.getElementById ("pic"). Innerhtml= " ';} function Show ()//Click on the right arrow to display the hidden column section {//First step: Display the column list document.getElementById ("Lanmu"). style.display= "";//Second step: Change arrows at the same time, The left arrow responds with an event that hides hide () document.getElementById ("pic"). Innerhtml= " ';} </script>
(1) Effect:


(2) Description: the "left arrow" is initially displayed, click on the image will respond to the hide () event, the section is hidden, while the left arrow is replaced by the right arrow. When the "right arrow" is clicked, it responds to the show () event, shows the hidden column section, and changes the right arrow to the left arrow and back to the original state. This is actually very simple and easy to do.


Through this stage of JavaScript learning, it feels interesting. In the case of nothing before, always think hard, give yourself psychological pressure, when personally to experience, found that it is so, slowly cultivate the interest of learning. Now when you log into a website or use a software, you will not consciously consider how it is implemented, where it is done well, where it needs to be improved, and gradually approaching a professional.

JavaScript to learn a lot of things, today is just the tip of the iceberg, with interest and curiosity to continue to refuel!


JavaScript Practical Tips-Implementing columns Display

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.