国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

[ASP.NET]制作一個簡單的多頁Tab功能

2024-07-10 12:56:42
字體:
來源:轉載
供稿:網友


我們經常在主頁中要瀏覽分類信息,在c/s模式下,經常采用tab分頁的方式來做,然后將不同的信息放到不同的tab頁中,然后可以點擊頁簽去查看不同頁面中的內容。我們可以用網頁的iframe來實行這個功能,先建立一個主webform1,在上面放兩個按鈕來模擬頁簽(今后也可以用photoshop來制作更精美的頁簽),然后再建立兩個子form,webform2,webform3,當按鈕被按下的時候來切換iframe的src屬性去顯示不同的子頁面。具體代碼如下:

webform1.aspx
<%@ page language="c#" codebehind="webform1.aspx.cs" autoeventwireup="false" inherits="iframetest.webform1" %>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en" >
<html>
<head>
<title>webform1</title>
<meta content="microsoft visual studio .net 7.1" name="generator">
<meta content="c#" name="code_language">
<meta content="javascript" name="vs_defaultclientscript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetschema">
<style>.aaa {
border-top-style: none; border-right-style: none; border-left-style: none; background-color: #ffcc33; border-bottom-style: none
}
.bbb {
border-top-style: none; border-right-style: none; border-left-style: none; background-color: #99ffcc; border-bottom-style: none
}
</style>
</head>
<body ms_positioning="gridlayout">
<form id="form1" method="post" runat="server">
<asp:button id="button1" style="z-index: 101; left: 16px; position: absolute; top: 24px" runat="server"
text="button" cssclass="aaa"></asp:button>
<asp:button id="button2" style="z-index: 102; left: 72px; position: absolute; top: 24px" runat="server"
text="button" cssclass="bbb"></asp:button>
<iframe id="iframe1" style="border-right: 0px solid; border-top: 0px solid; z-index: 103; left: 16px; border-left: 0px solid; width: 648px; border-bottom: 0px solid; position: absolute; top: 40px; height: 288px"
runat="server"></iframe>
</form>
</body>
</html>

webform1.aspx.cs
.
.
.

private void button1_click(object sender, system.eventargs e)
{
iframe1.attributes.add("src","webform2.aspx");
}

private void button2_click(object sender, system.eventargs e)
{
iframe1.attributes.add("src","webform3.aspx");
}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 乐东| 张掖市| 临潭县| 新津县| 桑日县| 仲巴县| 肥西县| 玉林市| 乃东县| 黎平县| 科尔| 南华县| 鹤岗市| 集贤县| 桦川县| 江西省| 宿松县| 太康县| 赣州市| 陕西省| 榕江县| 苍溪县| 吕梁市| 通化市| 申扎县| 亳州市| 遵义市| 安龙县| 房山区| 苍南县| 河源市| 娄底市| 梓潼县| 土默特右旗| 深州市| 安康市| 道真| 岳阳县| 安西县| 砀山县| 玉山县|