动态设置iframe宽高

<!DOCTYPE html>
<html>
<head>
  <title>t2</title>
  <script>
  //获取浏览器窗口宽高
var winWidth = 0; 
var winHeight = 0; 

function findDimensions() //函数:获取尺寸 
{ 
//获取窗口宽度 
if (window.innerWidth) 
winWidth = window.innerWidth; 
else if ((document.body) && (document.body.clientWidth)) 
winWidth = document.body.clientWidth; 
//获取窗口高度 
if (window.innerHeight) 
winHeight = window.innerHeight; 
else if ((document.body) && (document.body.clientHeight)) 
winHeight = document.body.clientHeight; 
//通过深入Document内部对body进行检测,获取窗口大小 
if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) 
{ 
winHeight = document.documentElement.clientHeight; 
winWidth = document.documentElement.clientWidth; 
} 
console.log(winHeight+","+winWidth);
} 
findDimensions();

function reSetWH(obj)
{  
	obj.width = winWidth;
	obj.height = winHeight;
}
</script>
 
</head>
<body>
<h1>t2</h1>

<iframe id="stage" src="jooflash.html" frameborder="0" width="640" height="480" onload="reSetWH(this);">
  no frames
</iframe>
</body>
</html>

获取浏览器窗口宽高

<script>
  //获取浏览器窗口宽高
var winWidth = 0; 
var winHeight = 0; 

function findDimensions() //函数:获取尺寸 
{ 
//获取窗口宽度 
if (window.innerWidth) 
winWidth = window.innerWidth; 
else if ((document.body) && (document.body.clientWidth)) 
winWidth = document.body.clientWidth; 
//获取窗口高度 
if (window.innerHeight) 
winHeight = window.innerHeight; 
else if ((document.body) && (document.body.clientHeight)) 
winHeight = document.body.clientHeight; 
//通过深入Document内部对body进行检测,获取窗口大小 
if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) 
{ 
winHeight = document.documentElement.clientHeight; 
winWidth = document.documentElement.clientWidth; 
} 
console.log(winHeight+","+winWidth);
} 
findDimensions();
</script>