iframe页面示例(求完整的iframe自适应高度例子,最好是整个网页源代码)

本文目录
- 求完整的iframe自适应高度例子,最好是整个网页源代码
- asp.net中iframe框架的简单例子,要有使用
- iframe 内显示的网页 只显示改网页的某一部分!怎么写
- 网页设计浮动框架制作(带有滚动条效果),iframe语法完整使用,求实例
- 用iframe标签如何实现左右分栏,求例子
- jquery 如何实现iframe页面的切换
求完整的iframe自适应高度例子,最好是整个网页源代码
//iframe 自适应宽高
《iframe src =““ frameborder=“0“ marginheight=“0“ marginwidth=“0“ frameborder=“0“ scrolling=“auto“ id=“id“ name=“ifm“ onload=“javascript:iframesize(’id’);“ width=“100%“》《/iframe》
function iframesize(obj) {
var pTar = null;
if (document.getElementById){
pTar = document.getElementById(obj);
}
else{
eval(’pTar = ’ + obj + ’;’);
}
if (pTar && !window.opera){
/*begin resizing iframe */
pTar.style.display=“block“;
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
/*ns6 syntax*/
pTar.height = pTar.contentDocument.body.offsetHeight;
pTar.width = pTar.contentDocument.body.scrollWidth;
}
else if (pTar.Document && pTar.Document.body.scrollHeight){
/*ie5+ syntax*/
pTar.height = pTar.Document.body.scrollHeight;
pTar.width = pTar.Document.body.scrollWidth;
}
}
}
asp.net中iframe框架的简单例子,要有使用
《table width=“100%%“ border=“0“ cellspacing=“0“ cellpadding=“0“》
《tr》
《td 》《iframe name=top marginwidth=0 marginheight=0 src=“top.asp“ frameborder=0 scrolling=“no“ width=“100%“ height=“100“》《/iframe》《/td》
《/tr》
《tr》
《td》《table width=“100%%“ border=“0“ cellspacing=“0“ cellpadding=“0“》
《tr》
《td width=“20%“》《iframe name=left marginwidth=0 marginheight=0 src=“left.asp“ frameborder=0 scrolling=“no“ width=“100%“ 》《/iframe》《/td》
《td width=“80%“》《iframe name=body marginwidth=0 marginheight=0 src=“body.asp“ frameborder=0 scrolling=“no“ width=“100%“ 》《/iframe》《/td》
《/tr》
《/table》《/td》
《/tr》
《tr》
《td》《iframe name=foot marginwidth=0 marginheight=0 src=“foot.asp“ frameborder=0 scrolling=“no“ width=“100%“ height=“50“》《/iframe》《/td》
《/tr》
《/table》
iframe 内显示的网页 只显示改网页的某一部分!怎么写
首先提供一个需要现在位置大小的一个div 然后 在这个div 中引入要加载的页面并指定具体要查看内容的位置,下面提供了一个示例便你参考,如不理解可以追问我。
《div class=“groupnews_insideL“ style=“width:800px;margin-left:10px; overflow:hidden;position:relative;“》
《iframe id=“jin10“ width=“125%“ height=“5000“ frameborder=“0“ style=“position:relative; top:-175px; float:left; left:-193px;“ scrolling=“no“ src=“http://www.kuaixun360.com/data/2.html“ name=“jin10“》
《!DOCTYPE html》
《html》
《/iframe》
《/div》
《iframe name=“left“ id=“rightMain“ src=“left.html“ frameborder=“false“ scrolling=“auto“ style=“border:none;“ width=“100%“ height=“470“ allowtransparency=“true“》《/iframe》
《iframe name=“right“ id=“rightMain“ src=“right.html“ frameborder=“false“ scrolling=“auto“ style=“border:none;“ width=“100%“ height=“470“ allowtransparency=“true“》《/iframe》
在left.html里放超链接 《a href=’test.html’ target=“right“》测试《/a》
这样,在左边点击,就会在右边框架显示了
网页设计浮动框架制作(带有滚动条效果),iframe语法完整使用,求实例
《div align=“center“》
《iframe id=“frame_content“ name=“twt“ src=“homepage.html“ width=“1008“ height=“100%“ marginwidth=“0“ marginheight=“0“ align=“middle“ scrolling=“no“ frameborder=“0“ onload=“this.height=100“》《/iframe》
《script type=“text/javascript“》
function reinitIframe(){
var iframe = document.getElementById(“frame_content“);
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》
《/div》
用iframe标签如何实现左右分栏,求例子
frameset的rows属性,用逗号隔开几个就分成几栏(里面的数字表示分栏的宽度),* 代表默认(均分栏、补全页面)
《frameset rows=“*,*“ “》
《frame name=“left“ src=““》
《frame name=“right“ src=““》
《/frameset》
这个例子就是均分成两栏
jquery 如何实现iframe页面的切换
query取得iframe中元素的几种方法
在iframe子页面获取父页面元素
代码如下:
$(’#objId’, parent.document);
// 搞定...
在父页面 获取iframe子页面的元素
代码如下:
$(“#objid“,document.frames(’iframename’).document)
$(document.getElementById(’iframeId’).contentWindow.document.body).html()
显示iframe中body元素的内容。
$(“#testId“, document.frames(“iframename“).document).html();
根据iframename取得其中ID为“testId“元素
$(window.frames[“iframeName“].document).find(“#testId“).html()
用JS或jQuery访问页面内的iframe,兼容IE/FF
注意:框架内的页面是不能跨域的!
假设有两个页面,在相同域下.
index.html 文件内含有一个iframe:
XML/HTML代码
《!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》
《meta http-equiv=“Content-Type“ content=“text/html; charset=gb2312“ /》
《title》页面首页《/title》
《/head》
《body》
《iframe src=“iframe.html“ id=“koyoz“ height=“0“ width=“0“》《/iframe》
《/body》
《/html》
iframe.html 内容:
XML/HTML代码
《!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》
《meta http-equiv=“Content-Type“ content=“text/html; charset=gb2312“ /》
《title》iframe.html《/title》
《/head》
《body》
《div id=“test“》www.koyoz.com《/div》
《/body》
《/html》
1. 在index.html执行JS直接访问:
JavaScript代码
document.getElementById(’koyoz’).contentWindow.document.getElementById
(’test’).style.color=’red’
通过在index.html访问ID名为’koyoz’的iframe页面,并取得此iframe页面内的ID为’test’的
对象,并将其颜色设置为红色.
此代码已经测试通过,能支持IE/firefox .
2. 在index.html里面借助jQuery访问:
JavaScript代码
$(“#koyoz“).contents().find(“#test“).css(’color’,’red’);
此代码的效果和JS直接访问是一样的,由于借助于jQuery框架,代码就更短了.
收集网上的一些示例:
用jQuery在IFRAME里取得父窗口的某个元素的值
只好用DOM方法与jquery方法结合的方式实现了
1. 在父窗口中操作 选中IFRAME中的所有单选钮
$(window.frames[“iframe1“].document).find(“input:radio“).attr(“checked“,“true“);
2. 在IFRAME中操作 选中父窗口中的所有单选钮
$(window.parent.document).find(“input:radio“).attr(“checked“,“true“);
父窗口想获得IFrame中的Iframe,就再加一个frames子级就行了,如:
$(window.frames[“iframe1“].frames[“iframe2“].document).find(“input:radio“).attr(“checked“,“true“);

更多文章:
windows程序设计第五版(《WINDOWS程序设计》和《WINDOWS核心编程》的区别)
2026年10月15日 11:30
issued retroactively(FORM E上盖“ISSUED RETROACTIVELY”的问题,小女在线等待)
2026年10月15日 10:30
begin和start的区别(start与begin的区别)
2026年10月15日 09:20
vant官网中文(范特365 是韩国化妆品VANT36.5吗)
2026年10月15日 09:10
prison break(越狱(prison break)到底是在讲个什么)
2026年10月15日 06:50
c程序设计第五版教学视频(求C程序设计(第五版)谭浩强教材源代码、视频课件等电子版资料!谢谢大家!)
2026年10月15日 06:40





