<script type="text/javascript">
$(function () {
//加载时添加的标签卡
if ('<%=Request["mid"] %>'=="1") {
addTab('标题1', '/test.aspx', false);
}
else if('<%=Request["mid"] %>'=="2") {
addTab('标题2', '/test1.aspx', false);
}
});
//添加标签 title:标签名 url:iframe对应网址 isclose:是否带关闭按钮
function addTab(title, url, isclose) {
//生成页面显示标签的HTML代码
var tabLength = $("#ttab li").children().length; var tabName = 'tabContent' + tabLength;
var tabTitle = 'tabTitle' + tabLength;
var tabTitleHtml = '';
if (isclose)
tabTitleHtml = '<li id="' + tabTitle + '"><a href="#' + tabName + '"><span>' + title + '<img src="/new_images/close.png" onclick="closeTab(' + tabLength + ')" /></span></a></li>';
else
tabTitleHtml = '<li><a href="#' + tabName + '"><span>' + title + '</span></a></li>';
$("#ttab").append(tabTitleHtml);
$("#tab-body").append('<div id="' + tabName + '" class="content"><iframe width="100%" height="100%" src="' + url + '" scrolling="auto"></iframe></div>'); ReShow();
}
function menuBind() {
$("#example ul li a").each(function (index) {
$(this).unbind("click");
$(this).bind("click", function () {
var obj = $("#example ul li a").eq(index);
var lk = obj.attr("datalink");
if (typeof (obj.attr("datalink")) != "undefined") {
addTab(obj.text(), lk, true);
}
});
});
}
function ckTabName(name) {
$("#ttab li a").each(function (index) {
$("#err").append(name + ' ' + $(this).text() + '<br>');
if (name == $(this).text())
return false;
});
return true;
}
//关闭标签(无需调用)
function closeTab(page) {
$("#tabTitle" + page).remove();
$("#tabContent" + page).remove();
ReShow();
}
//无需调用
function ReShow() {
$("#ttab li a").each(function (index) {
$(this).unbind("click");
$(this).bind("click", function () {
$("#ttab li").removeClass("z-crt");
$("#ttab li").eq(index).addClass("z-crt");
var tabName = $("#ttab li a").eq(index).attr('href');
tabName = tabName.substring(1, tabName.length);
$('.content').hide();
$('#tab-body div').eq(index).show();
});
});
$("#ttab li a:last").click();
}
</script> <div class="g-tab" id="tab1">
<div class="m-hd">
<ul id="ttab">
<li><a id="Desktop" href="#Desktop"><span>我的桌面</span></a></li>
</ul>
</div>
<div id="tab-body">
<div id="Desktop" class="content" ><iframe width="100%" height="100%" src="/MyDeskTop/MyPrompt.aspx" scrolling="auto"></iframe></div>
</div>
</div>

简单实现Tab切换(带框架)的更多相关文章

  1. 简单的Tab切换组件

    由于代码都有注释,所以不多加解释,大家都知道的.直接贴代码: 代码如下: /** * 简单的Tab切换 * 支持可配置项 如下参数 */ function Tab(){ this.config = { ...

  2. react简单的tab切换 (styled-components)

    其实,在我们日常的编程当中,经常会碰到tab切换的模块,那么,实现他的方法也有很多中,下面是一款简单,容易理解的react tab切换方法. 通过设置state中的current 属性去控制tab 和 ...

  3. jquery实现简单的Tab切换菜单

    实现tab切换的主要html代码: <div class="container"> <ul class="tabs"> <li c ...

  4. DIV+CSS 样式简单布局Tab 切换

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

  5. jQuery实现简单的tab切换

    html: <section>   <nav id="nav">     <a class="on">tab1</a& ...

  6. 【angular】angular实现简单的tab切换

    html: <div class="list-group" ng-repeat="tab in menuList"> <a href=&quo ...

  7. 从一个简单的Tab切换开始——与AJAX的结合

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. 最简单的tab切换

    JS: $(".con").eq(0).show();    $(".btn span").click(function(){        var num = ...

  9. react实现的tab切换组件

    我有点想要吐槽,因为用原生的js实现起来挺简单的一个小东西,改用react来写却花了我不少时间,也许react的写法只有在复杂的web应用中才能体现出它的优势吧!不过吐槽归吐槽,对react这种优雅的 ...

随机推荐

  1. 第十章 使用MapKit

    本项目是<beginning iOS8 programming with swift>中的项目学习笔记==>全部笔记目录 ------------------------------ ...

  2. User Attributes - Inside Active Directory

    User Attributes - Inside Active Directory Related to the book Inside Active Directory, ISBN 0-201-61 ...

  3. SQLHelper用到的配置文件格式

    格式要牢记 <configuration> <connectionStrings> <add name="dbConnStr" connectionS ...

  4. JS高级设计第七章——复习知识点

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

  5. HYSBZ1036 树链剖分

    这题我建了2棵线段树,这样来处理 最值和和值,简单的题目. #include<queue> #include<stack> #include<cmath> #inc ...

  6. Gson 的使用

    Gson 的使用简介Gson 是 Google 开发的Java API,用于转换Java对象 和 Json 对象. 使用Maven 依赖<dependency> <groupId&g ...

  7. nmap常用命令

    1) 获取远程主机的系统类型及开放端口 nmap -sS -P0 -sV -O <target> 这里的 < target > 可以是单一 IP, 或主机名,或域名,或子网 - ...

  8. Cocos2d-X3.0 刨根问底(八)----- 场景(Scene)、层(Layer)相关源码分析

    本章节我们重点分析Cocos2d-x3.0与 场景.层相关的源码.这部分源码集中在 libcocos2d –> layers_scenes_transitions_nodes目录下面 我先发个截 ...

  9. CAS做单点登陆(SSO)——集成BIEE 11g

    BIEE 11G和CAS集成零代码编写,只需配置. 更改BIEE analytics应用的web.xml 将analytics.war解包(使用7-zip或者Win-rar就可以),然后修改WEB-I ...

  10. POJ1002 487-3279

    Description 企业喜欢用容易被记住的电话号码.让电话号码容易被记住的一个办法是将它写成一个容易记住的单词或者短语.例如,你需要给滑铁卢大学打电话时,可以拨打TUT-GLOP.有时,只将电话号 ...