2006年02月27日
同一ドメインでの利用
こちら側
<SCRIPT language=JavaScript> function OpenIFrame() { var objFrame = document.getElementById("RefIFrame"); objFrame.style.display = ""; } function CloseIFrame() { var objFrame = document.getElementById("RefIFrame") objFrame.style.display = "none"; } function TransferData() { if ( document.all ) { document.frames[0].document.getElementsByName("field")[0].value = document.getElementsByName("field")[0].value; } else { window.frames[0].document.getElementsByName("field")[0].value = document.getElementsByName("field")[0].value; } } </SCRIPT> <INPUT type=text name=field> <INPUT style='width:80px' type=button value="開く" onClick='OpenIFrame()'> <INPUT style='width:80px' type=button value="閉じる" onClick='CloseIFrame()'> <INPUT style='width:80px' type=button value="データ転送" onClick='TransferData()'> <br /> <IFRAME id=RefIFrame style=' width:400; height:100; display:none; ' src='/IFrame.htm' ></IFRAME>IFRAME 側
<SCRIPT language=JavaScript> function CloseIFrame() { var objFrame = parent.document.getElementById( "RefIFrame" ); objFrame.style.display = "none"; } function TransferData() { parent.document.getElementsByName( "field" )[0].value = document.getElementsByName("field")[0].value; } </SCRIPT> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=Shift_JIS"> </HEAD> <BODY> <INPUT style='width:80px' type=button value="閉じる" onClick='CloseIFrame()'> <br> <INPUT style='width:80px' type=button value="データ転送" onClick='TransferData()'> <br> <INPUT type=text name="field"> </BODY>