login and signup 注册和登录tab页面
JavaScript Code
- <script type="application/javascript">
- $(document).ready(function()
- {
- $(".tab").click(function()
- {
- var X=$(this).attr('id');
- if(X=='signup')
- {
- $("#login").removeClass('select');
- $("#signup").addClass('select');
- $("#loginbox").slideUp();
- $("#signupbox").slideDown();
- }
- else
- {
- $("#signup").removeClass('select');
- $("#login").addClass('select');
- $("#signupbox").slideUp();
- $("#loginbox").slideDown();
- }
- });
- });
- </script>
XML/HTML Code
- <div style="margin:40px">
- <div id="container">
- <div id="tabbox">
- <a href="#" id="signup" class="tab signup">Signup</a>
- <a href="#" id="login" class="tab select">Login</a>
- </div>
- <div id="panel">
- <div id="loginbox"><h1>Login Form</h1></div>
- <div id="signupbox"><h1>Singup Form</h1></div>
- </div>
- </div>
- </div>
CSS Code
- <style>
- body
- {
- font-family:Arial, Helvetica, sans-serif;
- font-size:12px; background-color:#333;
- }
- #container
- {
- width:350px
- }
- #tabbox
- {
- height:40px
- }
- #panel
- {
- background-color:#aaa;
- height:300px;
- }
- .tab
- {
- background: #ccc;
- display: block;
- height: 40px;
- line-height: 40px;
- text-align: center;
- width: 80px;
- float: rightright;
- font-weight: bold;
- -webkit-border-top-left-radius: 4px;
- -webkit-border-top-rightright-radius: 4px;
- -moz-border-radius: 4px 4px 0px 0px;
- }
- a
- {
- color: #000;
- margin: 0;
- padding: 0;
- text-decoration: none;
- }
- .signup
- {
- margin-left:8px;
- }
- .select
- {
- background-color:#aaa;
- }
- #loginbox
- {
- height:300px;
- padding:10px;
- }
- #signupbox
- {
- height:300px;
- padding:10px;
- display:none;
- }
- </style>
原文地址:http://www.freejs.net/article_biaodan_142.html