C大调卡农属于几级:求教关于iframe自动适应连接内容大小的问题

来源:百度文库 编辑:高考问答 时间:2024/04/27 23:38:40
例如:

index.htm里的代码:

<html>
<body>
<table>
<tr>
<td><iframe src="iframe.htm" name="a1" frameborder="0" width="变量1" height="变量2"></iframe>
</td>
</tr>
</table>
</body>
</html>

iframe.htm里的代码:

<html>
<body>
<table width="变量3" height="变量4">
<tr>
<td>内容</td>
</tr>
</table>
</body>
</html>

现我就是想:

当"变量3"变化时"变量1"也随之变化
当"变量4"变化时"变量2"也随之变化

有谁可以帮我编一下这个代码呀!!!

<%
session("变量1")="10"
session("变量1")="10"
%>
<html>
<body>
<table>
<tr>
<td><iframe src="iframe.htm" name="a1" frameborder="0" width="<%=session("变量1")%>" height="<%=session("变量2")%>" iframe>
</td>
</tr>
</table>
</body>
</html>

<html>
<body>
<table width="<%=session("变量1")%>" height="<%=session("变量2")%>">
<tr>
<td>内容</td>
</tr>
</table>
</body>
</html>

我给你改了一下,还可以自行调节
index.htm里的代码:

<html>
<body>
<table>
<tr>
<td><iframe src="iframe.htm" id=frmDetail scrolling=no name=mm frameborder="1" style="width:expression(contentWindow.document.all.tblDetail.width);height:expression(contentWindow.document.all.tblDetail.height)"></iframe>
<br>
<button onclick="with(document.all.frmDetail.contentWindow.document.all.tblDetail){width=offsetWidth+1}">+</button>
<button onclick="with(document.all.frmDetail.contentWindow.document.all.tblDetail){width=offsetWidth-1}">-</button> <br>
</td>
</tr>
</table>
</body>
</html>

iframe.htm
<html>
<body leftmargin=0 topmargin=0>
<table border=0 id="tblDetail" width="100" height="100">
<tr>
<td>ÄÚÈÝ</td>
</tr>
</table>
</body>
</html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
overflow:hidden;
}
-->
</style></head>

<body >
<iframe width="100%" height="100%" src="http://www.163.com" frameborder="0" scrolling="auto"></iframe>
</body>
</html>

很简单,将iframe的大小设为自动。