jquery iframe自适应高度代码(浏览器兼容)
2013-06-08 11:50
651 查看
这里提供一款由jquery提供iframe自适应高度代码并且是兼容多浏览器iframe自适应高度。
更多详细内容请查看:http://www.111cn.net/wy/jquery/jquery_iframe.htm
$("#ipersonalinfo").load(function() {
$(this).height($(this).contents().height());
})
iframe 自适应高度
<script type=”text/网页特效”>
//iframe 自适应高度
function setcwinheight(){
var bobo=document.getelementbyid(”main”); //iframe id
if (document.getelementbyid){
if (bobo && !window.opera){
if (bobo.contentdocument && bobo.contentdocument.body.offsetheight){
bobo.height = bobo.contentdocument.body.offsetheight;
}else if(bobo.document && bobo.document.body.scrollheight){
bobo.height = bobo.document.body.scrollheight+30;
//alert(document.getelementbyid(”amdright”).style.width);
}
}
}
}
</script>
<iframe id=”main” name=”main” src=”main.php教程” scrolling=”no” width=”100%” frameborder=”0′ onload=”setcwinheight()”></iframe>
方法二
<script type="text/javascript">
function resizecontent()
{
$(window.parent.document).find("#if1").height($("#content").height());
}
function show400()
{
if($("#test400").css教程("display") == "none")
{
$("#test400").css("display","");
resizecontent();
}
else
{
$("#test400").css("display","none");
resizecontent();
}
}
$(document).ready(function(){
resizecontent();
})
</script>
更多详细内容请查看:http://www.111cn.net/wy/jquery/jquery_iframe.htm
$("#ipersonalinfo").load(function() {
$(this).height($(this).contents().height());
})
iframe 自适应高度
<script type=”text/网页特效”>
//iframe 自适应高度
function setcwinheight(){
var bobo=document.getelementbyid(”main”); //iframe id
if (document.getelementbyid){
if (bobo && !window.opera){
if (bobo.contentdocument && bobo.contentdocument.body.offsetheight){
bobo.height = bobo.contentdocument.body.offsetheight;
}else if(bobo.document && bobo.document.body.scrollheight){
bobo.height = bobo.document.body.scrollheight+30;
//alert(document.getelementbyid(”amdright”).style.width);
}
}
}
}
</script>
<iframe id=”main” name=”main” src=”main.php教程” scrolling=”no” width=”100%” frameborder=”0′ onload=”setcwinheight()”></iframe>
方法二
<script type="text/javascript">
function resizecontent()
{
$(window.parent.document).find("#if1").height($("#content").height());
}
function show400()
{
if($("#test400").css教程("display") == "none")
{
$("#test400").css("display","");
resizecontent();
}
else
{
$("#test400").css("display","none");
resizecontent();
}
}
$(document).ready(function(){
resizecontent();
})
</script>
相关文章推荐
- jquery iframe自适应高度代码(浏览器兼容)
- jquery兼容各种浏览器的iframe自适应高度的脚本
- 两段超简单jquery代码解决iframe自适应高度问题(不用判断浏览器高度)
- 基于jquery的兼容各种浏览器的iframe自适应高度的脚本
- 基于jquery的兼容各种浏览器的iframe自适应高度的脚本
- 两段超简单jquery代码解决iframe自适应高度问题(不用判断浏览器高度)
- JavaScript设置IFrame高度自适应(兼容多浏览器)
- 兼容主流浏览器的iframe自适应高度js脚本
- iframe自适应高度(兼容多种浏览器)
- Iframe的高度自适应且兼容谷歌,火狐,IE和360等主流浏览器
- JQuery IFrame框架高度自适应(支持嵌套–兼容IE,ff,safafi,chrome)
- 兼容firefox的iframe高度自适应代码
- 兼容多浏览器的iframe自适应高度(ie8 、谷歌浏览器4.0和 firefox3.5.3)
- 沫沫金;;最新Iframe全浏览器兼容自适应高度解决方案
- Iframe自适应高度绝对好使的代码 兼容IE,遨游,火狐
- 使用jQuery不判断浏览器高度解决iframe自适应高度问题
- 兼容主流浏览器的iframe自适应高度js脚本
- JavaScript设置IFrame高度自适应(兼容多浏览器)
- jQuery解决iframe高度自适应代码