在框架(iframe)中怎麼動態顯示網頁

想實現的功能:  
  default.aspx如下:  
  <Script   Language="C#"   Runat="Server">  
          public   void   Page_Load(Object   src,EventArgs   e)  
          {  
                  string   Login_System   =   Request.QueryString["Login_System"];  
                  if(Login_System!=null)  
                  {  
                          switch(Login_System)  
                          {  
                                    case   "1":  
                                    //當等於1時,加載一個1.aspx  
                                    //加載到workspace裏去  
                                    case   "2":  
                                    //當等於1時,加載一個2.aspx  
             //同上  
                                    ........  
                          }  
                  }  
            }  
  </Script>  
  <html>  
  <head>  
  </head>  
  <body>  
          <iframe   width="100%"   height="100%"   border=0   frameBorder=0   name="workspace"   id="workspace"></iframe>  
  </body>  
  </html>  

 

<Script   Language="C#"   Runat="Server">  
          public   string   frameSrc   =   "";  
          public   void   Page_Load(Object   src,EventArgs   e)  
          {  
                  string   Login_System   =   Request.QueryString["Login_System"];  
                  if(Login_System!=null)  
                  {  
                          switch(Login_System)  
                          {  
                                    case   "1":  
                                    //當等於1時,加載一個1.aspx  
                                    //加載到workspace裏去  
                                    frameSrc   =   "1.aspx"  
                                    case   "2":  
                                    //當等於1時,加載一個2.aspx  
             //同上  
                  frameSrc   =   "2.aspx"  
                                    ........  
                          }  
                  }  
            }  
  </Script>  
  <html>  
  <head>  
  </head>  
  <body>  
          <iframe   width="100%"   height="100%"   border=0   frameBorder=0   name="workspace"   id="workspace"   src="<%=   frameSrc%>"></iframe>  
  </body>  
  </html>   

 

 

Full   code   below.  
  <Script   Language="C#"   Runat="Server">  
  public   string   frameSrc   =   "http://www.chinaren.com";//set   default   value  
          public   void   Page_Load(Object   src,EventArgs   e)  
          {  
                  string   Login_System   =   Request.QueryString["Login_System"];  
                  if(Login_System!=null)  
                  {  
                          switch(Login_System)  
                          {  
                                    case   "1":  
                                    //當等於1時,加載一個1.aspx  
                                    //加載到workspace裏去  
                                    frameSrc   =   "http://www.sohu.com";  
                                    break;  
                                    case   "2":  
                                    //當等於1時,加載一個2.aspx  
             //同上  
  frameSrc   =   "http://www.sina.com";  
  break;  
                                  //   ........  
                                  default:{  
                                  frameSrc   =   "http://www.chinaren.com";  
                                  break;  
                                  }  
                          }  
                  }  
            }  
  </Script>  
  <html>  
  <head>  
  </head>  
  <body>  
          <iframe   width="100%"   height="100%"   border=0   frameBorder=0   name="workspace"   id="workspace"   src="<%=   frameSrc%>"></iframe>  
  </body>  
  </html> 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章