<script type="text/javascript" >
function TabPage(width, height, tabTitleArray, tabPageArray)
{
var ids = new Array();
var id = document.uniqueID;
var tabTitleHtml = "";
var index = 0;
for (var i = 0; i < tabTitleArray.length; i++)
{
tabTitleHtml += "<table border='0' cellspacing='0' cellpadding='0' width='" + width + "'>"
+ "<tbody><tr>";
var titles = tabTitleArray[i];
for (var n = 0; n < titles.length; n++)
{
var myId = id + index;
ids[index] = myId;
var title = titles[n];
tabTitleHtml += "<td class='TabTitle'"
+ " onclick=\"secBoard(this, '" + myId + "')\">" + title + "</td>";
index++;
}
tabTitleHtml += "</tr></tbody></table>";
}
var tabPageHtml = "";
for (var i = 0; i < tabPageArray.length; i++)
{
tabPageHtml += "<tbody id='" + ids[i] + "' style='display:none''>"
+ "<tr><td>" + tabPageArray[i] + "</td>" + "</tr></tbody>";
}
var controlID = document.uniqueID.toString();
var html = "<table id='" + controlID + "' width='" + width + "' border='0'><tbody><tr><td>"
+ tabTitleHtml
+ "<table border='0' cellspacing='0' cellpadding='0' width='" + width
+ " ' height='" + height +"' class='TabPage'>"
+ tabPageHtml
+ "</table>"
+ "</td></tr></tbody></table>";
document.write(html);
document.getElementById(controlID).rows[0].cells[0].children[0].rows[0].cells[0].click();
}
function secBoard(obj, tabPageID)
{
var currentTabTitleTable = obj.parentNode.parentNode.parentNode;
var container = obj.parentNode.parentNode.parentNode.parentNode;
for (var n = 0; n < container.children.length - 1; n++) {
var cells = container.children[n].rows[0].cells;
for(var i = 0; i < cells.length; i++)
{
var cell = cells[i]
if (cell.className == "SelectedTabTitle")
{
cell.className = "TabTitle";
break;
}
}
}
obj.className = "SelectedTabTitle";
var tabPageTable = container.lastChild;
for (var i = 0; i < container.children.length; i++)
{
var node = container.children[i];
if (node != currentTabTitleTable) continue;
if (node.nextSibling == tabPageTable) break;
node.swapNode(node.nextSibling);
node = container.children[i+1];
}
for(var i = 0; i < tabPageTable.tBodies.length; i++)
{
var tbody = tabPageTable.tBodies[i];
if (tbody.style.display != "none")
{
tbody.style.display = "none";
break;
}
}
document.getElementById(tabPageID).style.display = "block";
}
function GetPinYinArray()
{
var pinYinArray = new Array(
new Array('a','ai','an','ang','ao'),
new Array('ba','bai','ban','bang','bao','bei','ben','beng','bi','bian','biao','bie','bin','bing','bo','bu'),
new Array('ca','cai','can','cang','cao','ce','cen','ceng','cha','chai','chan','chang','chao','che','chen','cheng','chi','chong','chou','chu','chua','chuai','chuan','chuang','chui','chun','chuo','ci','cong','cou','cu','cuan','cui','cun','cuo'),
new Array('da','dai','dan','dang','dao','de','deng','di','dia','dian','diao','die','ding','diu','dong','dou','du','duan','dui','dun','duo'),
new Array('e','en','er'),
new Array('fa','fan','fang','fei','fen','feng','fo','fou','fu'),
new Array('ga','gai','gan','gang','gao','ge','gei','gen','geng','gong','gou','gu','gua','guai','guan','guang','gui','gun','guo'),
new Array('ha','hai','han','hang','hao','he','hei','hen','heng','hong','hou','hu','hua','huai','huan','huang','hui','hun','huo'),
new Array(),
new Array('ji','jia','jian','jiang','jiao','jie','jin','jing','jiong','jiu','ju','juan','jue','jun','jv'),
new Array('ka','kai','kan','kang','kao','ke','ken','keng','kong','kou','ku','kua','kuai','kuan','kuang','kui','kun','kuo'),
new Array('la','lai','lan','lang','lao','le','lei','leng','li','lia','lian','liang','liao','lie','lin','ling','liu','long','lou','lu','luan','lue','lun','luo','lv'),
new Array('ma','mai','man','mang','mao','me','mei','men','meng','mi','mian','miao','mie','min','ming','miu','mo','mou','mu'),
new Array('na','nai','nan','nang','nao','ne','nei','nen','neng','ni','nian','niang','niao','nie','nin','ning','niu','nong','nou','nu','nuan','nue','nuo','nv'),
new Array('o','ou'),
new Array('pa','pai','pan','pang','pao','pei','pen','peng','pi','pian','piao','pie','pin','ping','po','pou','pu'),
new Array('qi','qia','qian','qiang','qiao','qie','qin','qing','qiong','qiu','qu','quan','que','qun'),
new Array('ran','rang','rao','re','ren','reng','ri','rong','rou','ru','ruan','rui','run','ruo'),
new Array('sa','sai','san','sang','sao','se','sen','seng','sha','shai','shan','shang','shao','she','shen','sheng','shi','shou','shu','shua','shuai','shuan','shuang','shui','shun','shuo','si','song','sou','su','suan','sui','sun','suo'),
new Array('ta','tai','tan','tang','tao','te','teng','ti','tian','tiao','tie','ting','tong','tou','tu','tuan','tui','tun','tuo'),
new Array(),
new Array(),
new Array('wa','wai','wan','wang','wei','wen','weng','wo','wu'),
new Array('xi','xia','xian','xiang','xiao','xie','xin','xing','xiong','xiu','xu','xuan','xue','xun'),
new Array('ya','yan','yang','yao','ye','yi','yin','ying','yo','yong','you','yu','yuan','yue','yun'),
new Array('za','zai','zan','zang','zao','ze','zei','zen','zeng','zha','zhai','zhan','zhang','zhao','zhe','zhen','zheng','zhi','zhong','zhou','zhu','zhua','zhuai','zhuan','zhuang','zhui','zhun','zhuo','zi','zong','zou','zu','zuan','zui','zun','zuo')
);
var array = new Array(pinYinArray.length);
for (var i = 0; i < pinYinArray.length; i++)
{
var html = "";
var myArray = pinYinArray[i];
for (var n = 0; n < myArray.length; n++)
{
html += myArray[n] + " ";
}
html += "";
array[i] = html;
}
return array;
}
function GetFirstLetterArray()
{
var array = new Array(
new Array('A','B','C','D','E','F','G'),
new Array('H','I','J','K','L','M','N'),
new Array('O','P','Q','R','S','T'),
new Array('U','V','W','X','Y','Z'));
return array;
}
new TabPage(200, 50,GetFirstLetterArray(), GetPinYinArray() );
var titleArray = new Array(
new Array(1, 2, 3, 4),
new Array(5, 6, 7, 8),
new Array(9, 10, 11, 12),
new Array(13, 14, 15, 16));
var pageArray =
new Array(1, 2,3 ,4, 5,6,7,8,9,10,11,12,13,14,15,16);
new TabPage(200, 50,titleArray, pageArray );
</script>
<style type="text/css">
.TabTitle {
text-align: center;
background-color:#99CC99;
cursor: hand;
color: #000000;
border-left: 1px solid #F0F0F0;
border-top: 1px solid #F0F0F0;
border-right: 1px solid gray;
border-bottom: 1px solid #F0F0F0
}
.SelectedTabTitle {
text-align: center;
background-color: #D2D8D8;
cursor: hand;
color: blue;
border-left: 1px solid #F0F0F0;
border-top: 1px solid #F0F0F0;
border-right: 1px solid gray;
}
.TabPage {
background-color: #D2D8D8;
color: #000000;
border-left:1px solid #F0F0F0;
border-right: 1px solid gray;
border-bottom: 1px solid gray;
}
</style>
分享到:
相关推荐
在Windows应用程序开发中,TabControl控件是一个非常常用且功能强大的组件,它允许用户通过不同的页面(TabPage)来组织和切换内容。本项目提供了一个自定义的TabPage控件,旨在提升用户体验,使其外观更加美观和...
本文将详细讲解如何通过重绘TabControl来实现Tabpage标签的自定义,包括添加图片和关闭按钮。 首先,为了实现这个功能,我们需要在代码中创建一个自定义的TabControl事件处理程序。在示例代码中,`MainTabControl_...
在“HTML5实现tabpage”的主题中,我们主要关注的是如何利用HTML5的新特性来创建可切换的选项卡(tabpage)布局。 首先,HTML5中的`<section>`和`<article>`标签可以用来组织和结构化内容,创建出清晰的选项卡区域...
在Android开发中,`TabPage`通常指的是`ViewPager`与`TabLayout`的组合,用于创建一个可以滑动切换页面的布局,通常用在应用的主界面或者导航菜单中。`ViewPager`负责展示多个子页面,而`TabLayout`则提供在顶部的...
管理系统主界面,使用tabcontrol分页在tabpage显示各子界面,实现各tabpage子窗体只能单开,打开同一个tabpage时,会激活到已开的tabpage中;并实现双击tabpage关闭和右键点击菜单关闭或全部关闭。附上程序实例与...
在标题“自定义Winform控件TabControl,可同时存在左右tabpage”中,我们讨论的是一个经过定制的TabControl控件,它扩展了这一功能,使得标签页可以同时出现在左侧和右侧,为用户界面设计提供了更多灵活性。...
在本项目"js实现的Muti TabPage切换"中,我们将探讨如何使用JavaScript来实现多标签页(TabPage)的切换功能,这在许多后台管理系统中非常常见。这个项目不仅包括基本的页面切换,还提供了添加新标签页和删除已有...
在本示例中,我们探讨的是如何在TabControl控件中模拟IE7浏览器的样式,即在每个TabPage上添加一个可关闭的按钮。TabControl是Windows Forms中的一个控件,它允许用户在多个选项卡之间切换,类似于浏览器中的标签页...
C#中控制tabpage可见内容不可用,网上有很多法子,都是说删除再创建,但我这个方法最好,我觉得,原创哈
在C#编程中,`TabPage`是Windows Forms应用程序中经常使用的控件,它通常与`TabControl`一起使用,用于创建一个多页面的用户界面。`TabControl`允许用户在不同的`TabPage`之间切换,每个`TabPage`可以承载不同的内容...
在Microsoft Foundation Classes (MFC)框架中,`VC TabPage`通常指的是在SDI (Single Document Interface)应用程序中使用TabControl控件来实现多个视图之间的切换。SDI是一种用户界面设计模式,允许用户同时处理一个...
在VB.NET编程环境中,开发一个具有自定义功能的模拟浏览器是一项常见的任务,特别是当需要对TabPage控件进行扩展以实现类似浏览器的行为时。在这个场景中,我们要关注两个主要的知识点:在TabPage上添加和绘制关闭...
标题 "a Tabpage of Office2007 Style" 指的是一个采用了微软Office 2007界面设计风格的选项卡页面。在IT领域,选项卡页面(Tabpage)通常用于用户界面(UI),它允许用户在多个视图或工作区之间切换,而无需打开多...
【CTabCtrlSSL_demo.zip】是一个包含VC++项目的压缩包,该项目主要展示了如何在Visual C++环境下使用`CTabCtrlSSL`控件来创建和管理带有SSL风格的标签页(TabPage)。`CTabCtrlSSL`是`CTabCtrl`的一个增强版本,提供...
TabControl由一个或多个TabPage组成,每个TabPage代表一个独立的“页面”。然而,有时我们需要根据用户操作或者特定条件动态地隐藏或显示TabPage。由于TabPage自身并不直接提供Visible属性,所以我们需要采取其他...
TabPage tabPage1 = new TabPage("页1"); tabControl1.TabPages.Add(tabPage1); ``` 3. 删除TabPage: - 使用`TabControl.TabPages.Remove(TabPage tabPage)`或`TabControl.TabPages.RemoveAt(int index)`可以...
"关闭按钮的TabPage" 指的是在每个TabItem(即标签页)上添加一个关闭按钮,使得用户可以交互式地关闭当前的标签页。这种功能常见于许多现代应用中,以提供更加灵活的用户界面。 在WPF中实现这个功能,主要涉及以下...
TabControl由一系列TabPage组成,每个TabPage都有一个标题,我们可以针对这些标题进行样式调整。在C#中,我们通常会通过操作TabControl和TabPage的属性,或者自定义绘制(DrawItem事件)来实现样式更改。 1. **修改...
在`TabPage.zip`压缩包中,我们可以找到一个简单的示例项目,它演示了如何在对话框中使用`CTabCtrl`。通过这个例子,开发者可以学习到以下关键知识点: 1. **创建CTabCtrl对象**:首先,在对话框类的成员变量中声明...
2. 添加TabPage对象:然后,为每个新的选项卡创建一个TabPage对象,如`oTabPage = CreateObject("TabPage")`。接下来,可以设置TabPage的属性,比如标题、背景色等。 3. 将TabPage添加到TabSet:使用TabSet对象的`...