html: '<iframe src="Content.aspx"></iframe>' 定义src为变量 html: '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="Content.aspx"></iframe>'以上这句代码,能不能将 src=变量,那么就可以不用写死,如果能,应该如何操作。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在后台定义个public变量iframe ,然后src='<%=iframe%' <iframe scrolling="auto" id="ifrm" frameborder="0" width="100%" height="100%"></iframe>'<script>document.getElementById("ifrm").src = "XXXX.aspx;</script> <iframe id="iframe1" scrolling="auto" frameborder="0" width="100%" height="100%" src="Content.aspx" runat="server"></iframe>后台:iframe1.Attribute["src"]=""; <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="Content.aspx"></iframe>这种方式调用Iframe有两个诟病: a.性能问题(SRC指向的页面内容多时或很长时,加载速度特别慢) b.高度自适应问题给你个完美的解决方案:iframe异步加载<SCRIPT> function createIframe() { var i = document.createElement("iframe"); i.id="NewsFrm"; i.src = <%=this.变量%>; i.scrolling = "no"; i.setAttribute("frameborder", "0", 0); i.width = "100%"; document.getElementById("FrameArea").appendChild(i); }; // Check for browser support of event handling capability if (window.addEventListener) window.addEventListener("load", createIframe, false); else if (window.attachEvent) window.attachEvent("onload", createIframe); else window.onload = createIframe; function reinitIframe(){ var iframe = document.getElementById("NewsFrm"); try{ var bHeight = iframe.contentWindow.document.body.scrollHeight; var dHeight = iframe.contentWindow.document.documentElement.scrollHeight; var height = Math.max(bHeight, dHeight); iframe.height = height; }catch (ex){} } window.setInterval("reinitIframe()", 200); </SCRIPT><body><div id="FrameArea" style="height: auto"></div></body> C# 关于页面跳转与传值 asp.net url重写 在本地可以传到虚拟主机上就不行了??? 请教一条SQL asp.net 如何读取子目录下的 config 文件? 哪里有开源的论坛代码? 100 分,菜鸟表白 - C# 2005 中的 MenuItemClick 事件 asp.net 如何做收发邮件(有图片也有文字的)? 取后台数据在前台像报表一样的显示。 asp.net页面回传 写入文本,提示没有权限??请教!!! 功能设计问题,求大家指教 List<MyClass>使用的问题
<iframe scrolling="auto" id="ifrm" frameborder="0" width="100%" height="100%"></iframe>'<script>
document.getElementById("ifrm").src = "XXXX.aspx;
</script>
b.高度自适应问题给你个完美的解决方案:iframe异步加载
<SCRIPT>
function createIframe() {
var i = document.createElement("iframe");
i.id="NewsFrm";
i.src = <%=this.变量%>;
i.scrolling = "no";
i.setAttribute("frameborder", "0", 0);
i.width = "100%";
document.getElementById("FrameArea").appendChild(i);
};
// Check for browser support of event handling capability
if (window.addEventListener) window.addEventListener("load", createIframe, false);
else if (window.attachEvent) window.attachEvent("onload", createIframe);
else window.onload = createIframe; function reinitIframe(){
var iframe = document.getElementById("NewsFrm");
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height;
}catch (ex){}
}
window.setInterval("reinitIframe()", 200); </SCRIPT><body>
<div id="FrameArea" style="height: auto"></div>
</body>