首页
IT服务
解决方案
IT实战培训
关于我们
您的位置 :
ITLead >>
技术交流
>>
软件开发
>>
Microsoft .Net
同域IFrame如何自动调节高度?
来源:广州中睿信息技术有限公司
发布时间:
2012/10/21 23:25:16
编辑:
itlead
阅读
2085
次
同域IFrame如何自动调节高度?代码控制操作,可参考本文。
应用自适应IFrame主页面
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Domain.aspx.cs" Inherits="WebApplication1.Domain" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>域IFrame自动高度</title> <script language="javascript" src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> </head> <body style="margin: 0 0 0 0"> <form id="form1" runat="server"> <div> <script type="text/javascript" language="javascript"> window.onload = (function () { $("#iframePreview").height($("#iframePreview").contents().height()); $("#iframePreview1").height($("#iframePreview1").contents().height()); $("#iframePreview2").height($("#iframePreview2").contents().height()); }); </script> <iframe id="iframePreview" src="IframeContent.aspx" style="width: 100%;" scrolling="no" frameborder="0"></iframe> <iframe id="iframePreview1" src="IframeContent1.aspx" style="width: 100%;" scrolling="no" frameborder="0"></iframe> <iframe id="iframePreview2" src="IframeContent.aspx" style="width: 100%;" scrolling="no" frameborder="0"></iframe> </div> </form> </body> </html> 说明: 1.引入jquery-1.4.1.js库 2.<iframe id="iframePreview" src="IframeContent.aspx" style="width: 100%;" scrolling="no" frameborder="0"></iframe> <iframe id="iframePreview1" src="IframeContent1.aspx" style="width: 100%;" scrolling="no" frameborder="0"></iframe> <iframe id="iframePreview2" src="IframeContent.aspx" style="width: 100%;" scrolling="no" frameborder="0"></iframe>
里面是普通的asp页面。
本站技术原创栏目文章均为中睿原创或编译,转载请注明:文章来自
中睿
,本站保留追究责任的权利。
相关阅读
· Asp.Net Couchbase Memcached图文安装调用开发2013.11.25
· 使用Aspose.Cells组件生成Excel文件实例2013.11.25
· 如何在.net中定制Nhibernate属性?2012.10.21
· MVC3 自定义HtmlHelper截断文本内容2012.10.21
· 如何获取ASPX页面的服务端控件ClientID?2012.10.21