例如:如何在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。 它是這樣的: