下面的這個例子實現了在服務器端得到可編輯Iframe的Html源代碼非典功能。代碼很簡單,這裡疾苦不多解釋了。代碼如下:
GetIframeHtml.axpx
<%@ Page Language="<a href="http://dev.21tx.com/language/vb/" target="_blank">VB</a>" validateRequest=false AutoEventWireup="false"
Codebehind="GetIframeHtml.<a href="http://dev.21tx.com/web/asp/" target="_blank">ASP</a>x.vb" Inherits="ASPx<a href="http://dev.21tx.com/web/" target="_blank">Web</a>.GetIframeHtml"%>
<Html>
<body>
<form id="frmMain" method="post" runat="server">
<iframe id="ifrHTML" name="ifrHtml"></iframe>
<br>
<asp:Button id="cmdSend" runat="server" Text=" 提 交 "></ASP:Button>
<input type="hidden" name="hidValue">
</form>
<script>
ifrHtml.document.designMode = "on";
</script>
</body>
</Html>
GetIframeHtml.ASPx.vb
Public Class GetIframeHtml
Inherits System.Web.UI.Page
Protected WithEvents cmdSend As System.Web.UI.WebControls.Button
Protected WithEvents ifrHTML As System.Web.UI.HtmlControls.HtmlGenericControl
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object,_
ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region