在asp.net页面中创建标签的代码不起作用 [英] Code for creating tabs in asp.net page is not working

查看:73
本文介绍了在asp.net页面中创建标签的代码不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在网络表单中创建一个标签页
这是我给的代码,不起作用

I want to create a tab inside the webform
this is the code i have given which is not working

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script src="javascript.js" type="text/javascript"></script>

   <style type="text/css">
        .tab-box {
border-bottom: 1px solid #DDD;
padding-bottom:5px;
}
.tab-box a {
border:1px solid #DDD;
color:#666666;
padding: 5px 15px;
text-decoration:none;
background-color: #eee;
}
.tab-box a.activeLink {
background-color: #fff;
border-bottom: 0;
padding: 6px 15px;
}
.tabcontent { border: 1px solid #ddd; border-top: 0;}
.hide { display: none;}


    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <div class="tab-box">
<a href="javascript.js" class="tabLink activeLink" id="cont-1">Tab 1</a>
<a href="javascript.js" class="tabLink " id="cont-2">Tab 2</a>
<a href="javascript.js" class="tabLink " id="cont-3">Tab 3</a>
</div>

<div class="tabcontent paddingAll" id="cont-1-1">
This is content box one
</div>

<div class="tabcontent paddingAll hide" id="cont-2-1">
This is content box Two
</div>

<div class="tabcontent paddingAll hide" id="cont-3-1">
This is content box Three
</div>


    </div>
    </form>
</body>
</html>






js文件代码为






The js file code is

<script type="text/javascript">
$(document).ready(function() {
$(".tabLink").each(function(){
$(this).click(function(){
tabeId = $(this).attr('id');
$(".tabLink").removeClass("activeLink");
$(this).addClass("activeLink");
$(".tabcontent").addClass("hide");
$("#"+tabeId+"-1").removeClass("hide")
return false;
});
});
});
</script>

推荐答案

(document).ready(function(){
(document).ready(function() {


(.tabLink").each(function (){
(".tabLink").each(function(){


(this).click(function(){ tabeId =
(this).click(function(){ tabeId =


这篇关于在asp.net页面中创建标签的代码不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆