日期:2014-05-18 浏览次数:21077 次
<!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 type="text/javascript">
function fnShow(){
document.getElementById('pnl_test').style.display = 'block';
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="javascript:void 0" onclick="fnShow()">显示隐藏层</a>
<asp:Panel ID="pnl_test" runat="server" style="width:400px;height:300px;border:1px solid #000;">
<asp:Button ID="btn_post" runat="server" Text=" 回传 " />
</asp:Panel>
</div>
</form>
</body>
</html>
------解决方案--------------------
步骤是 Session 中一个特定的key
eg: Session["State"]=null;
这个时候就是未显示的 ,当显示的时候 修改 Session["State"]="Show";
每次页面加载的时候都判断 Session["State"] ,来决定 div 是否显示
关闭的时候 在设置 Session["State"]=null;