用div+iframe 代替frameset 框架

frameset 已经过时, 使用frameset会带来很多问题,比如session丢失等. 所以提倡用iframe,iframe的好处我就不用多说了.下面用div+iframe来代替frameset的收缩与展开功能.

  1. <%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" Inherits="ProductServices10._Default" %>  
  2.   
  3.   
  4.   
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  6.   
  7. <html xmlns="http://www.w3.org/1999/xhtml">  
  8.   
  9. <head id="Head1" runat="server">  
  10.   
  11.     <title>产品服务系统</title>  
  12.   
  13.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  14.   
  15.     <style type="text/css">  
  16.   
  17.         html,body{  
  18.   
  19.      margin:0px;  
  20.   
  21.      height:100%;  
  22.   
  23.     }  
  24.   
  25.     </style>  
  26.   
  27.     <script language="javascript" type="text/javascript">  
  28.   
  29.         function DisplayNav()  
  30.   
  31.         {  
  32.   
  33.             var nav = document.getElementById('divLeft');  
  34.   
  35.             var main = document.getElementById('divmain');  
  36.   
  37.             if(nav.style.display=='block'|| nav.style.display=='')  
  38.   
  39.             {  
  40.   
  41.                 nav.style.display='none';  
  42.   
  43.                   
  44.   
  45.                 main.style.display = 'block';  
  46.   
  47.             }  
  48.   
  49.             else  
  50.   
  51.             {  
  52.   
  53.                 nav.style.display='block';  
  54.   
  55.                 main.style.marginleft='395px';  
  56.   
  57.             }  
  58.   
  59.         }  
  60.   
  61.     </script>  
  62.   
  63. </head>  
  64.   
  65. <body style="margin: 0; padding: 0; background-color: #0266C6;">  
  66.   
  67.     <form id="from1" runat="server">  
  68.   
  69.         <div id="divTop" style="width: 100%; height: 60px; border: none 0px">  
  70.   
  71.             <img src="Images/Top/toplogo.jpg" onclick="DisplayNav();" />  
  72.   
  73.         </div>  
  74.   
  75.         <div style="width:100%;height: 100%; border: none 0px">  
  76.   
  77.             <div id="divLeft" style="width: 195px; height:100%; overflow: hidden; float: left;">  
  78.   
  79.                 <iframe src="left.aspx" style="height: 100%" frameborder="0" border="0" marginwidth="0" marginheight="0" ></iframe>  
  80.   
  81.             </div>  
  82.   
  83.             <div id="divmain" style="height: 100%; border: none 0px">  
  84.   
  85.                      <iframe src="main.aspx" width="100%" height="100%" frameborder="0" border="0" marginwidth="0" marginheight="0" ></iframe>  
  86.   
  87.             </div>  
  88.   
  89.         </div>  
  90.   
  91.     </form>  
  92.   
  93. </body>  
  94.   
  95. <html>  
<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" Inherits="ProductServices10._Default" %>



<!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 id="Head1" runat="server">

    <title>产品服务系统</title>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <style type="text/css">

        html,body{

     margin:0px;

     height:100%;

    }

    </style>

    <script language="javascript" type="text/javascript">

        function DisplayNav()

        {

            var nav = document.getElementById('divLeft');

            var main = document.getElementById('divmain');

            if(nav.style.display=='block'|| nav.style.display=='')

            {

                nav.style.display='none';

                

                main.style.display = 'block';

            }

            else

            {

                nav.style.display='block';

                main.style.marginleft='395px';

            }

        }

    </script>

</head>

<body style="margin: 0; padding: 0; background-color: #0266C6;">

    <form id="from1" runat="server">

        <div id="divTop" style="width: 100%; height: 60px; border: none 0px">

            <img src="Images/Top/toplogo.jpg" onclick="DisplayNav();" />

        </div>

        <div style="width:100%;height: 100%; border: none 0px">

            <div id="divLeft" style="width: 195px; height:100%; overflow: hidden; float: left;">

                <iframe src="left.aspx" style="height: 100%" frameborder="0" border="0" marginwidth="0" marginheight="0" ></iframe>

            </div>

            <div id="divmain" style="height: 100%; border: none 0px">

                     <iframe src="main.aspx" width="100%" height="100%" frameborder="0" border="0" marginwidth="0" marginheight="0" ></iframe>

            </div>

        </div>

    </form>

</body>

<html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值