为简洁陈述问题,假设在我的本地目录下面,有若干个htm和png文件,在a.html里点击链接href="../b.htm"后进入b.htm,然后在b.htm里点击链接href="../c.png"进入c.png,此时我想选中a.html里id为100的CheckBox,以便我随后回到a.htm时,看见CheckBox被选中就知道图片c.png已被查看过了。我的问题如下:
我在点击href="../c.png"时,能用parent访问到b.htm里面的元素,并且用top访问到的也是b.htm,效果竟然跟parent一样,
但是没法用parent.parent或top访问a.htm里面的元素,返回值总是null,请问这是什么原因?
谢谢!
我在点击href="../c.png"时,能用parent访问到b.htm里面的元素,并且用top访问到的也是b.htm,效果竟然跟parent一样,
但是没法用parent.parent或top访问a.htm里面的元素,返回值总是null,请问这是什么原因?
谢谢!
b.parentWindow = this;b.htm中
function xx(){
var wA = this.parentWindow;
if(wA){
alert(wA.document.getElementById('100').checked);//寻找a窗口中的控件
}
}xx();
a.htm和b.htm的内容是表格:
<td class=style99><a href="./b.htm">I</a></td>
点击表格里的链接后都是转向其地址,而不是新打开一个窗口.
我用过onclick=foo(),
而在函数foo()里面没法用parent.parnt或top访问到父父窗口,得到的只是父窗口。