请问下大家,如果我有一个父页面A,然后有个他的弹出页面B,B是iframe,iframe又引用了一个页面C,然后我要在C页面给A页面赋值要怎么做?
代码如下:
<script language="javascript" type="text/javascript"> function open1(){ window.open('B.html','newwindow','height=400,width=600') } </script> <body> <a href="javascript:open1('tst');">点击查看1</a> <div style="width:120px; height:120px;" id="father">123</div> </body>
<body> <iframe id="a_frame" name="a_frame" src="C.html"></iframe> </body>
<script> function _showWidth(id){ //alert(parent.parent.document.getElementById(id).offsetWidth); //alert(parent.opener.document.getElementById(id).offsetWidth); //alert(document.frames("a_frame").parent.window.document.getElementById(id).offsetWidth); } </script> </head> <body> <a href="javascript:_showWidth('father');">点击查看3</a> </body>
然后我要在C页面访问A页面,上面注释的alert里面的方法都不可以。如果在B页面访问A页面,那没问题的,在C页面访问B页面那也是没问题,但是C访问A就不行了。
还望大家帮忙啊,本人先谢谢了!