下面的这个例子实现了在服务器端得到可编辑iframe的html源代码非典功能。代码很简单,这里疾苦不多解释了。代码如下:
getiframehtml.axpx
getiframehtml.aspx.vb
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.
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