问题挺简单的想了很多办法都解决不了,只好请大家帮助下了.
<iframe src="a.html"></iframe>;
a.html里使用jquery 代码设置外层框架里的元素
$(parent.document)无效,$(top.document)无效.
在使用$("div",top.document)以后发现顶层居然就是a.html.但是self!=top却为真.
是不是对 <iframe src="a.html"></iframe>;这种框架来说.a.html里的元素不能操作外界框架的元素丫.
<iframe src="a.html"></iframe>;
a.html里使用jquery 代码设置外层框架里的元素
$(parent.document)无效,$(top.document)无效.
在使用$("div",top.document)以后发现顶层居然就是a.html.但是self!=top却为真.
是不是对 <iframe src="a.html"></iframe>;这种框架来说.a.html里的元素不能操作外界框架的元素丫.
$("div",parent.document)测试过了,查找到的第一个层就是a.html里的层
获取上级页面的window对象:var parentWindow = parent;
获取最顶层的window对象:var topWindow = top;
获取节点: parentWindow.getElementById("xx")或者topWindow.getElementById("xx")
函数调用:parentWindow.fun()或者topWindow.fun()
<script type="text/javascript">
function dd() {
$("#test", window.parent.document).text("adfasdfasdfadsf");
}
</script>