如何让iframe根据浏览器的宽度以及高度变化,自动改变大小 请教各位大虾了我有一个iframe,浏览器在打开的时候不是最大化,如果我把浏览器最大化之后,iframe的大小还是没有改变,还是浏览器刚打开时候的大小。请问如何解决这个问题呀,我就是想让它根据浏览器的大小改变,自动调整大小 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 直接定义长宽100%<iframe width="100%" height="100%" src="http://www.baidu.com"></iframe> 怎么会不行呢,LZ试下这段代码<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>test</title></head><body><iframe width="100%" height="100%" src="http://www.baidu.com"></iframe></body></html> <body onresize="changeIframeSize()">用body的onresize事件也可以 <table cellpadding="0" cellspacing="0" width="100%" style="height:100%; margin:0; padding:0;"> <tr> <td colspan="2" style="height:69px;margin:0; padding:0;"><iframe style="height:69px;" src="{{site_path}}frame/header/" name="header" width="100%" scrolling="no" frameborder="0"></iframe></td> </tr> <tr id='bodytr'> <td id='bodytd' valign="top" width="160" style="margin:0; padding:0;" ><iframe src="{{site_path}}frame/menu/" name="menu" width="160" height="100%" scrolling="no" frameborder="0"></iframe></td> <td valign="top" width="100%" style="margin:0; padding:0;" ><iframe src="{{site_path}}frame/main/" name="main" width="100%" height="100%" frameborder="0" scrolling="yes" style="overflow:visible;"></iframe></td> </tr></table><script type="text/javascript"> var height = document.body.offsetHeight var bodytr = document.getElementById('bodytr') bodytr.style.height = height - 69; //document.getElementById('bodytd').style.height = '100%'; var Sys = {}; var ua = navigator.userAgent.toLowerCase(); window.ActiveXObject ? Sys.ie = ua.match(/msie ([\d.]+)/)[1] : 0 ; document.getBoxObjectFor ? Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1] : 0 ; window.MessageEvent && !document.getBoxObjectFor ? Sys.chrome = (ua.match(/chrome\/([\d.]+)/) ? ua.match(/chrome\/([\d.]+)/)[1] : '') : 0; window.opera ? Sys.opera = ua.match(/opera.([\d.]+)/)[1] : 0; window.openDatabase ? Sys.safari = ua.match(/version\/([\d.]+)/)[1] : 0; if (!Sys.ie){ document.getElementById('bodytd').style.height = '100%';} </script> 引用 3 楼 dickeychen 的回复:width="100%",不行啊怎么会不行呢,LZ试下这段代码HTML code<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>test</title></head><body><iframe width="100%" height="100%" src="http://www.baidu.com"></iframe></body></html>---------OK,这中方式可以,谢谢了 xml可以代替小型数据库吗? JS如何获取PHP循环中的ID 高分!拍拍网登录密码加密Js程序分析 求css开发工具 求一个 根据客户IP地址 判断出 该IP 是国内 还是国外就可以 的代码 js/c#.net的都可以 请高手赐教 如何将一个jsp文件展现到页面的一个div层里面 探讨一个使用JS显示图片的问题 高分请教用JS解决类似拼图的问题,急,谢谢! 可不可以获得除文本之外的对象 怎么隐藏链接的 URL 地址 为什么有的时候onclick在firefox下不管用啊 一个JavaScript小问题。
<iframe width="100%" height="100%" src="http://www.baidu.com"></iframe>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>test</title></head><body>
<iframe width="100%" height="100%" src="http://www.baidu.com"></iframe>
</body></html>
<tr>
<td colspan="2" style="height:69px;margin:0; padding:0;"><iframe style="height:69px;" src="{{site_path}}frame/header/" name="header" width="100%" scrolling="no" frameborder="0"></iframe></td>
</tr>
<tr id='bodytr'>
<td id='bodytd' valign="top" width="160" style="margin:0; padding:0;" ><iframe src="{{site_path}}frame/menu/" name="menu" width="160" height="100%" scrolling="no" frameborder="0"></iframe></td>
<td valign="top" width="100%" style="margin:0; padding:0;" ><iframe src="{{site_path}}frame/main/" name="main" width="100%" height="100%" frameborder="0" scrolling="yes" style="overflow:visible;"></iframe></td>
</tr>
</table>
<script type="text/javascript">
var height = document.body.offsetHeight
var bodytr = document.getElementById('bodytr')
bodytr.style.height = height - 69;
//document.getElementById('bodytd').style.height = '100%';
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
window.ActiveXObject ? Sys.ie = ua.match(/msie ([\d.]+)/)[1] : 0 ;
document.getBoxObjectFor ? Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1] : 0 ;
window.MessageEvent && !document.getBoxObjectFor ? Sys.chrome = (ua.match(/chrome\/([\d.]+)/) ? ua.match(/chrome\/([\d.]+)/)[1] : '') : 0;
window.opera ? Sys.opera = ua.match(/opera.([\d.]+)/)[1] : 0;
window.openDatabase ? Sys.safari = ua.match(/version\/([\d.]+)/)[1] : 0; if (!Sys.ie){ document.getElementById('bodytd').style.height = '100%';}
</script>
width="100%",不行啊
怎么会不行呢,LZ试下这段代码
HTML code<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>test</title></head><body>
<iframe width="100%" height="100%" src="http://www.baidu.com"></iframe>
</body></html>
---------
OK,这中方式可以,谢谢了