Original code for switching an HTML Panel (div + CSS + JS)

Source: Internet
Author: User
Original code for switching an HTML Panel (div + CSS + JS)
 
The code is messy. Let's take a look.
------------------------------------------------
JS:
<SCRIPT type = "text/JavaScript">
<! --
Function showlayer (group, ID)
{
// Process item
VaR COUNT = 1;
VaR OBJ = Document. getelementbyid (group + "_ Item _" + count );
While (OBJ! = NULL)
{
OBJ. classname = "panel_item ";

Count ++;
OBJ = Document. getelementbyid (group + "_ Item _" + count );
}
Document. getelementbyid (group + "_ Item _" + id). classname = "panel_item_show ";

// Process Layer
Count = 1;
OBJ = Document. getelementbyid (group + "_ layer _" + count );
While (OBJ! = NULL)
{
OBJ. style. Display = "NONE ";

Count ++;
OBJ = Document. getelementbyid (group + "_ layer _" + count );
}
Document. getelementbyid (group + "_ layer _" + id). style. Display = "Block ";
}
// -->
</SCRIPT>
--------------------------------------------------------------
CSS:
/* Panel begin */
. Panel
{
Border-left: 1px solid # c1d5f1;
Border-Right: 1px solid # c1d5f1;
Border-bottom: 1px solid # c1d5f1;
}

. Panel_head
{
Color: #004499;
Height: 24px;
Line-Height: 24px;
}
. Panel_item
{
Float: left;

Border-top: 1px solid # c1d5f1;
Border-bottom: 1px solid # c1d5f1;
Background-color: # e7f1ff;

Text-align: center;
}
. Panel_item_show
{
Float: left;

Border-top: 1px solid # c1d5f1;
Background-color: # ffffff;

Font-weight: bold;

Text-align: center;
}

. Panel_item_spacing
{
Float: left;

Height: 25px;

Border-left: 1px solid # c1d5f1;
Border-Right: 1px solid # c1d5f1;
Border-bottom: 1px solid # c1d5f1;
}

. Panel_body
{
Clear: both;
}

. Panel_foot
{
}
/* Panel end */
-----------------------------------------------------------
HTML:
<Div class = "Panel" style = "width: 250px;">
<Div class = "panel_head">
<Div id = "t_item_1" class = "panel_item_show" style = "width: 56px;" onmouseover = "showlayer ('T', 1);"> dizzy </div>
<Div class = "panel_item_spacing" style = "width: 6px;"> </div>
<Div id = "t_item_2" class = "panel_item" style = "width: 56px;" onmouseover = "showlayer ('T', 2);"> sweat </div>
<Div class = "panel_item_spacing" style = "width: 6px;"> </div>
<Div id = "t_item_3" class = "panel_item" style = "width: 56px;" onmouseover = "showlayer ('T', 3);"> Haha </div>
<Div class = "panel_item_spacing" style = "width: 6px;"> </div>
<Div id = "t_item_4" class = "panel_item" style = "width: 56px;" onmouseover = "showlayer ('T', 4);"> Haha </div>
</Div>
<Div class = "panel_body">
<Div id = "t_layer_1">
<P> 1 </P>
</Div>
<Div id = "t_layer_2" style = "display: none;">
<P> 2 </P> <p> 2 </P>
</Div>
<Div id = "t_layer_3" style = "display: none;">
<P> 3 </P> <p> 3 </P> <p> 3 </P>
</Div>
<Div id = "t_layer_4" style = "display: none;">
<P> 4 </P> <p> 4 </P> <p> 4 </P> <p> 4 </P>
</Div>
</Div>
</Div>

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.