例如:如何在firefox中使用JQuery访问parent.document元素?
$(elementid,top.document).attr(attributeName)
或
$(elementid,parent.document).attr(attributeName)
在IE或Chrome,但不工作在Firefox。
有谁知道什么是火狐等价物?
谢谢!
例如:如何在firefox中使用JQuery访问parent.document元素?
$(elementid,top.document).attr(attributeName)
或
$(elementid,parent.document).attr(attributeName)
在IE或Chrome,但不工作在Firefox。
有谁知道什么是火狐等价物?
谢谢!
什么:
window.parent.$(elementid).attr(attributeName);
它的工作原理!谢谢! – 2009-07-15 19:57:18
尝试
$(elementid,window.parent.frames[0].document).attr(attributeName)
什么是你想实现 - 也许能给在上下文中的问题将让你更好的解决方案。
这是行不通的。我试图从在iframe中调用的点击函数访问iframe外部的元素。 – 2009-07-15 19:31:23
而且飞奔之前,不要忘记document.domain = "yourdomain.com"
g $(selector, parent.document)
,因为我遇到了“访问被拒绝”问题,就像location.href
对于内联框架
top.document和parent.document都工作在Firefox中。你把什么放在了elementid和attributeName? – 2009-07-15 19:05:48
我认为它通常工作,就像使用$(elemmentid),但我从一个由iframe加载的html文件访问,并且无法访问外部html。 它是这样的: