Write tabPanel in javascript

Source: Internet
Author: User

 

Java code

<Html>

<Head>

<Meta content = "text/html; charset = UTF-8;"/>

<Style type = "text/css">

 

/* ------------ Tab ----------*/

. TabItemContainer {

Height: 30px;

Overflow: hidden;

Background: # F7F7F7 url(dot.gif) bottom repeat-x;

Margin-bottom: 6px;

}

. TabItemContainer. tab,

. TabItemContainer. blank {

Float: left;

Height: 24px;

Line-height: 24px;

Margin: 0;

Margin-right: 6px;

Margin-top: 6px;

Overflow: hidden;

Cursor: pointer;

}

. TabItemContainer. blank {

Width: 48px;

}

. TabItemContainer. tab div {

Float: left;

Height: 24px;

}

. TabItemContainer. selected {

 

}

. TabItemContainer. tab_left,

. TabItemContainer. selected. tab_left {

Background: url(tab_on_left.gif) no-repeat bottom right;

Width: 5px;

}

. TabItemContainer. tab_middle,

. TabItemContainer. selected. tab_middle {

Padding: 0 16px;

}

. TabItemContainer. selected. tab_middle {

Background: url(tab_on_center.gif) repeat-x bottom; s

Padding: 0 16px;

}

. TabItemContainer. tab_right,

. TabItemContainer. selected. tab_right {

Background: url(tab_on_right.gif) no-repeat bottom left;

Width: 5px;

}

. TabItemContainer. tab_left {

Background: url(tab_off_left.gif) no-repeat bottom right;

}

. TabItemContainer. tab_middle {

Background: url(tab_off_center.gif) repeat-x bottom right;

}

. TabItemContainer. tab_right {

Background: url(tab_off_right.gif) no-repeat bottom left;

}

/* ------------ Tab end ----------*/

</Style>

<Script type = "text/javascript">

// Change the tab style,

Function changeTab (tabIndex ){

Var tabIndexVal = parseInt (tabIndex );

// Var tabCount = jQuery ('# tabCount'). val ();

For (var I = 1; I <= 3; I ++ ){

// Change the tab Style

If (tabIndexVal = I ){

Document. getElementById ('tab '+ I). className = "tab selected ";

 

Document. getElementById ('D' + I). style. display = "block ";

// JQuery ('# tab' + I). removeClass ("tab ");

// JQuery ('# tab' + I). addClass ("tab selected ");

} Else {

Document. getElementById ('tab '+ I). className = "tab ";

 

Document. getElementById ('D' + I). style. display = "none ";

// JQuery ('# tab' + I). removeClass ("tab selected ");

// JQuery ('# tab' + I). addClass ("tab ");

}

}

 

// Submit2Times (tabKey );

}

</Script>

</Head>

 

<Body>

<Div class = "tabItemContainer">

 

 

<Div id = "tab1" class = "tab selected">

<Div class = "tab_left"> </div>

<Div class = "tab_middle">

<A href = "javascript: changeTab (1);">

First tab page

</A>

</Div>

<Div class = "tab_right"> </div>

</Div>

<Input id = "first" type = "hidden" value = "asdf"/>

<Div id = "tab2" class = "tab">

<Div class = "tab_left"> </div>

<Div class = "tab_middle">

<A href = "javascript: changeTab (2);">

Second tab page

</A>

</Div>

<Div class = "tab_right"> </div>

</Div>

<Input id = "secinput" type = "hidden" value = "asdf"/>

 

<Div id = "tab3" class = "tab">

<Div class = "tab_left"> </div>

<Div class = "tab_middle">

<A href = "javascript: changeTab (3);">

First tab page www.2cto.com

</A>

</Div>

<Div class = "tab_right"> </div>

</Div>

<Input id = "third" type = "hidden" value = "asdf"/>

 

 

 

</Div>

<Div id = "d1" style = "float: left; width: 100%; height: 500px; background-color: #891989">

First

</Div>

 

<Div id = "d2" style = "display: none; float: left; width: 100%; height: 500px; background-color: #893986">

Second

</Div>

 

<Div id = "d3" style = "display: none; float: left; width: 100%; height: 500px; background-color: #896983">

Thrid

</Div>

</Body>

</Html>

 

 

Author: unparalleled Rama

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.