これが私がそれを機能させた方法です。JavaScriptが必要です:
フォーム1:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script>
function changeDiv() {
frames["myiFrame"].document.getElementById("divInFrame").setAttribute("style", "height:1000px");
}
</script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<input id="Button1" type="button" value="button" onclick="changeDiv();" />
<iframe src="Default2.aspx" style="border: 0px #FFFFFF none;" name="myiFrame" id="myiFrame"
scrolling="no" frameborder="1" marginheight="0px" marginwidth="0px" height="60px"
width="468px"></iframe>
</form>
</body>
</html>
フォーム2:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div id="divInFrame">
I am the second form!
</div>
</form>
</body>
</html>
したがって、基本的にこの行はすべてを担当しています。
frames["myiFrame"].document.getElementById("divInFrame").setAttribute("style", "height:1000px");
このアプローチを使用すると、Vb から高さを設定する必要は必ずしもないことに注意してください。前の質問のように、通常の HTML div が必要なだけです。