我使用了 3 个 .asp 页面
第1页:Parent.asp 第 2 页:Subparent.asp 第 3 页:Child.asp
在 child.asp 中使用 javascript。我想将数据从子窗口(iframe)传递到父窗口
<title>parent.asp</title>
<html>
<body>
<iframe name="I1" frameborder="0" scrolling="no" src="Subparent.asp" width="100"
height="100">
<title>subparent.asp</title>
<html>
<body>
<div id ="parentdata"></div>
<iframe name="I1" frameborder="0" scrolling="no" src="Subparent.asp" width="100" height="100">
<title>subparent.asp</title>
<html>
<body>
<iframe name="I1" frameborder="0" scrolling="no" src="Child.asp" width="100" height="100">
<title>subparent.asp</title>
<html>
<body>
<script language="JavaScript">
{
parent.document.getElementById("parentdata").innerHTML="GET DATA, WORKING"
}
</script>
</body>
</html>
</iframe>
</body>
</html>
</iframe>
</body>
</html>
</iframe>
</body>
</html>
在“Child.asp”中,我使用 javascipt。我想将数据传递给“parent.asp”的“”
有可能吗,请帮帮我
希望大家多多支持
最佳答案
也许 ajax 是满足您需要的最佳方式。 但如果您仍然喜欢 iframe,您可以尝试:
父级.asp:
function myFunction(pram1, param2)
{
alert('worked! - param1: '+param1.toString()+' param2: '+param2.toString());
}
子类.asp
top.myFunction(1,2);
关于javascript - 如何将数据从 iframe 传递到父窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2243575/