/*--顶级页面的document--*/
var obj = window.parent.document;
/*--获取第二个frameset,这里的$(obj)相当于JQ中的$(document)--*/
var frameset = $(obj).find('frameset:eq(1)').attr('cols');
/*隐藏头部的管理分类*/
var obj1 = window.parent.topFrame.document;
$(obj1).find('.header_white_pro').hide();
这里我试着用$()代替find()结果是错误的,我不晓得是何原因。
在添加一个问题。
chrome不支持跨frame的变量的获取
这个问题我是在http://blog.sina.com.cn/s/blog_4b5bc0110100wgq0.html中看到的。因为我都是在iis下看我的页面的,所有没有太注意这个问题。
alert(iframe.contentWindow.document);
只有在chrome里弹出是undefined,其它浏览器都是object HTMLDocument,原来chrome不支持跨frame的变量的获取!于是乎,在iframe页面里调用window.parent.**在chrome里也是不允许的!
有没有好的办法呢????
无法在file://协议中运行,无法在本地运行,即所有关于window.praent的本地demo都将失效。不知道这算是chrome的特性还是一个bug。查看以下demo,在chrome 5.0.375.99中本地测试失效,但是在服务器上测试有效。