例如,怎样使iframe的高度和宽度 随着table的高度和宽度 改变而改变?如下:
Main.htm
1<html>
2<body>
3<div>
4<iframe <="" height="”变数”" iframe="" name="mm" src="”detail.htm”" width="”变数”">
5</iframe></div>
6</body>
7</html>
detail.htm
1<html>
2<body>
3<table bgcolor="red" border="0" height="”变数”" width="”变数”">
4<tr><td></td></tr>
5</table>
6</body>
7</html>
急切,请高手快指点!!!!
---------------------------------------------------------------
main.htm
1<html>
2<body>
3<div>
4<iframe id="frmDetail" name="mm" scrolling="no" src="detail.htm" style="width:expression(this.contentWindow.document.all.tblDetail.width);height:expression(this.contentWindow.document.all.tblDetail.height)"></iframe>
5<button onclick="with(document.all.frmDetail.contentWindow.document.all.tblDetail){width=offsetWidth+1}">+</button>
6<button onclick="with(document.all.frmDetail.contentWindow.document.all.tblDetail){width=offsetWidth-1}">-</button>
7</div>
8</body>
9</html>
detail.htm
1<html>
2<body leftmargin="0" topmargin="0">
3<table bgcolor="red" border="0" height="100" id="tblDetail" width="100">
4<tr><td></td></tr>
5</table>
6</body>
7</html>
---------------------------------------------------------------
稍微变通一下就是啦.
main.htm
1<html>
2<body>
3<div>
4<iframe id="frmDetail" name="mm" onload="style.width=this.contentWindow.document.all.tblDetail.offsetWidth;style.height=this.contentWindow.document.all.tblDetail.offsetHeight" scrolling="no" src="tb.htm"></iframe>
5</div>
6</body>
7</html>
tb.htm
1<html>
2<body leftmargin="0" topmargin="0">
3<table bgcolor="red" border="0" height="100" id="tblDetail" width="100">
4<tr><td>
5dddddddddddddddddddddddddddddddddddddddddddddddddddddddd
6</td></tr>
7</table>
8</body>
9</html>
---------------------------------------------------------------
test.asp
1
2url=Request.QueryString("url")
1<body onload="document.all.ifId.style.width=parseInt(ifId.document.getElementsByTagName('table')[0].width)+20">
2<iframe id="ifId" name="ifId" src="```
3=url
4```"></iframe>
5<br/>
6<a href="2.asp?url=1.asp">1.asp</a>
7<br/>
8<a href="2.asp?url=2.asp">2.asp</a>
9
101.asp
11<table width="500">
12<tr><td>
13aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
14</td></tr></table>
15
162.asp
17<table width="200">
18<tr><td>
19aaaaaaaaa
20</td></tr></table></body>