摘要:[ASP.NET]修改Frame的大小
問題:

常常在網路上看到利用Frame將網頁切成三個區塊
通常上面是擺網頁的標題,左下是功能欄,右下是主畫面
有時候會覺得主畫面不夠大,想要在看資料的時候讓功能欄暫時隱藏,等到需要用再叫出來
經過一番搜尋後找到解決方法
放Frame的主頁面
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test0420.aspx.vb" Inherits="test0420" %>
<!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>
</head>
<frameset rows="120,*,1" cols="*" frameborder="no" border="0" framespacing="0" id="row_frame">
<frame src="TestBanner.aspx" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" frameborder="1" />
<frameset rows="*" cols="5%,*" framespacing="0" frameborder="no" border="0" id="col_frame">
<frame src="UserLeft.aspx" name="left" scrolling="auto" noresize="noresize" id="left" title="left" frameborder="1" />
<frame src="UserRight.aspx" name="right" scrolling="auto" noresize="noresize" id="right" title="right" frameborder="1"/>
</frameset>
</frameset>
</html>
控制頁(UserRight.aspx)
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="UserRight.aspx.vb" Inherits="UserRight" %>
<!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 language="javascript" type="text/javascript">
function framehide() {
if (window.parent.row_frame.rows == "120,*,0") {
form1.frameshow.src = "worktool/left.gif";
framectrl.title = "HIDE"
window.parent.row_frame.rows = "120,*,1";
window.parent.col_frame.cols = "10%,*";
}
else {
form1.frameshow.src = "worktool/right.gif";
framectrl.title = "SHOW"
window.parent.row_frame.rows = "120,*,0";
window.parent.col_frame.cols = "0,*";
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="framectrl" onclick="framehide();" title="HIDE" style="cursor:pointer;"><img id="frameshow" src="worktool/feature_webbar.gif" alt="" /></div>
</div>
</form>
</body>
</html>
其中在UserRight.aspx中會有一個圖示,點Frame往左隱藏時會變成箭頭朝右,顯示時朝左

在此記錄
參考:http://hi.baidu.com/leilongbing/blog/item/d55afbefd4a095ebb3fb95ca.html