开发者

How pass data to parent window from iframe?

I using 3 .asp pages

Page 1 :Parent.asp page 2 :Subparent.asp Page 3 :Child.asp

using javascript in the child.asp. I wand to pass data from Child window(iframe) to Parent window

<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>

In the "Child.asp" i using javascipt. i wand to pass data to the "" of "parent.asp"

is it possible, plz help me开发者_运维百科

hoping your support


maybe ajax is the best way to do what you need. but if you still prefer the iframes, you can try:

Parent.asp:

function myFunction(pram1, param2)
{
    alert('worked! - param1: '+param1.toString()+' param2: '+param2.toString());
}

Child.asp

top.myFunction(1,2);


for some old-school info on windows and frames: http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.3/reference/window.html#1200703 which seems, as TeKapa reckons, to still work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜