Standard Layout application: Show/Hide Sidebar [with detailed annotations]_ experience Exchange

Source: Internet
Author: User
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > < HTML lang= "ZH-CN" xml:lang= "ZH-CN" xmlns= "http://www.w3.org/1999/xhtml" > <pead> <meta http-equiv= " Content-type "content=" text/html; charset=gb2312 "/> <title> Show/Hide </title> <style type=" Text/css "> <!--/* PR 50198763 * * *{margi n:0;padding:0;} /* Eliminate all tags inside and outside the default value of the patch/#left, #right {height:620px;} /* Defines the height of the container * * #left {background: #CCC;} /* Define background color to differentiate the left and right container/#right {background: #f5f5f5;} /* Ditto/* left{float:left;width:20%;d Isplay:block}/* Defines the width of the left container/* right{float:left;width:80%;d isplay:block;clear: Right;} /* Define the width of the right container/* left1{width:0%;d Isplay:none}/* Define the state of the left container when it is folded: hidden/--> </style> <script type= "Text/javas Cript "> function Pr () {var L=document.getelementbyid (" left ");//variable: L represents id=" left "tag var r=document.getelementbyi D ("right"); Variable: R represents id= "right" tag if (l.classname== "left")//judgment: If id= "left" Class value equals left, the following {} content {L.classname= "left1" is executed, and/or the mark to id= "Leave" plus class:left1 r.classname= ""; Id= "Right" tag plus class: space, that is, elimination class} else//judgment: If Id= "Left" class value is not equal to, will execute the contents of {} below {} L.C Lassname= "left"; Add Class:left r.classname= "right" to the id= "left" tag; Add Class:right} </script> </pead> <body> <div id= "left" to id= "right" gt;</div> <div id= "right" class= "yes" > show/Hide I am a JS beginner, shortcoming. This JS demo is actually very simple, I am here just want to say with JS Big: JS is behavior, do not fight style table. Some things should be done by CSS, for example: Display:none | | Display:block, it's overrun! I will only play CSS, get JS will not change, do not dare to change, alas. Clearly a class can be dumped to do the CSS, JS why to Rob to do it? Make our these will point CSS drop rookie good is depressed ~ Don't play CSS must be JS Mody? </div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

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.