The following example implements the SARS function of obtaining editable iframes on the server side. The code is very simple, so I won’t explain much about the suffering here. The code is as follows:
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="Submit"></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 withvents cmdsend as system.web.ui.webcontrols.button
protected withvents 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
private sub page_load(byval sender as system.object,_
byval e as system.eventargs) handles mybase.load
cmdsend.attributes.add("onclick", "document.frmmain.hidvalue.value" + _
" = ifrhtml.document.body.innerhtml;")
end sub
private sub cmdsubmit_click(byval sender as system.object,_
byval e as system.eventargs) handles cmdsend.click
dim strvalue as string
strvalue = request.form("hidvalue")
response.write(server.htmldecode(strvalue))
end sub
End class registers a member and creates your web development database.