ASP.NET中使用IFRAME建立类Modal窗口__教程 |
|
日期:2007-5-20 1:20:09 人气:47 [大 中 小] |
|
|
|
{ string strscript="<script language='javascript'>"; strscript += strScript; strscript += "</script>"; if(!mypage.IsStartupScriptRegistered(ID)) mypage.RegisterStartupScript(ID, strscript); } private void Button2_Click(object sender, System.EventArgs e) { IFRAME1.Attributes.Add("src","WebForm2.aspx?NAME='中国'"); CreateScript(Page,"ShowLayer();","SHOW"); } }
WebForm2.aspx
<%@ Page language="c#" Codebehind="WebForm2.aspx.cs" AutoEventWireup="false" Inherits="WSGUI1.WebForm2" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>WebForm2</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> <script language="javascript"> function hide() { parent.MyFormLayer.style.display = "none"; } </script> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form2" method="post" runat="server"> <table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#6887bb" height="100%" id="table1" style="BORDER-TOP-STYLE: outset; BORDER-RIGHT-STYLE: outset; BORDER-LEFT-STYLE: outset; BORDER-BOTTOM-STYLE: outset"> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> <p align="center"><font color="#ffffff">模仿模态窗口效果</font></p> <p align="center"><input type="button" onclick="hide()" style="WIDTH: 80px" value="点击关闭"> <asp:Button id="Button1" runat="server" Text="ASPXTest"></asp:Button></p> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> </form> </body> </HTML>
WebFom2.aspx.cs
namespace WSGUI1 { /// <summary> /// WebForm2 的摘要说明。 /// </summary> public class WebForm2 : System.Web.UI.Page { protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if(!IsPostBack) { Button1.Attributes.Add("onclick","hide()"); } }
} |
|
出处:本站原创 作者:佚名 |
|
|