欢迎光临
我们一直在努力

在服务器端得到可编辑Iframe的HTML源代码-.NET教程,面向对象编程

建站超值云服务器,限时71元/月

下面的这个例子实现了在服务器端得到可编辑iframe的html源代码非典功能。代码很简单,这里疾苦不多解释了。代码如下:

getiframehtml.axpx

<%@ page language="vb" validaterequest=false autoeventwireup="false" codebehind="getiframehtml.<a href="http://www.west999.com/www/go/?url=http://www.chinaitpower.com/dev/web/asp/index.html" target="_blank" rel="nofollow" >asp</a>x.vb&#8221; inherits=&#8221;<a href="http://www.west999.com/www/go/?url=http://www.chinaitpower.com/dev/web/asp/index.html" target="_blank" rel="nofollow" >asp</a>xweb.getiframehtml&#8221;%><br /> <html><br /> <body></p> <form id="frmmain" method="post" runat="server"> <iframe id="ifrhtml" name="ifrhtml"></iframe><br /> <br /> <<a href="http://www.west999.com/www/go/?url=http://www.chinaitpower.com/dev/web/asp/index.html" target="_blank" rel="nofollow" >asp</a>:button id=&#8221;cmdsend&#8221; runat=&#8221;server&#8221; text=&#8221; 提 交 &#8220;></<a href="http://www.west999.com/www/go/?url=http://www.chinaitpower.com/dev/web/asp/index.html" target="_blank" rel="nofollow" >asp</a>:button><br /> <input type="hidden" name="hidvalue"><br /> </form> <p> <script> ifrhtml.document.designmode = "on"; </script><br /> </body><br /> </html></p> <p>

getiframehtml.aspx.vb

public class getiframehtml<br /> inherits system.web.ui.page<br /> protected withevents cmdsend as system.web.ui.webcontrols.button<br /> protected withevents ifrhtml as system.web.ui.htmlcontrols.htmlgenericcontrol</p> <p>#region &#8221; web form designer generated code &#8221;</p> <p> this call is required by the web form designer.<br /> <system.diagnostics.debuggerstepthrough()> private sub initializecomponent()</p> <p> end sub</p> <p> private sub page_init(byval sender as system.object,_<br /> byval e as system.eventargs) handles mybase.init<br /> codegen: this method call is required by the web form designer<br /> do not modify it using the code editor.<br /> initializecomponent()<br /> end sub</p> <p>#end region</p> <p> private sub page_load(byval sender as system.object,_<br /> byval e as system.eventargs) handles mybase.load<br /> cmdsend.attributes.add(&#8220;onclick&#8221;, &#8220;document.frmmain.hidvalue.value&#8221; + _<br /> &#8221; = ifrhtml.document.body.innerhtml;&#8221;)<br /> end sub</p> <p> private sub cmdsubmit_click(byval sender as system.object,_<br /> byval e as system.eventargs) handles cmdsend.click<br /> dim strvalue as string<br /> strvalue = request.form(&#8220;hidvalue&#8221;)<br /> response.write(server.htmldecode(strvalue))<br /> end sub</p> <p>end class<br />

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 在服务器端得到可编辑Iframe的HTML源代码-.NET教程,面向对象编程
分享到: 更多 (0)