0
我有一個網頁(http://www.WillenhallPrimary.org/Science.shtml),它包含一個iframe。 iframe包含一個<h2 id="staff">Teachers</h2>
標記,我想使用父網址和哈希例如http://www.WillenhallPrimary.org/Science.shtml#staff。我還想等到頁面加載前跳躍。 (如果這更容易,我可以使用一個而不是#)。跳轉頁面到iframe中的id
iframe使用onLoad:javascript(因此它看起來像一個連續的 頁面)調整大小,但我不知道這是否影響它。
function rfs(){
_i=document.getElementById('ym')
_i.height=150
if(typeof _i.contentDocument!=='undefined'){
_cdd=_i.contentDocument.documentElement
_i.height=Math.max(_cdd.scrollHeight,_cdd.offsetHeight,_cdd.clientHeight)+25
}
else {
_cdb=_i.contentWindow.document.body
_i.height=Math.max(_cdb.scrollHeight,_cdb.offsetHeight,_cdb.clientHeight)+25
}
}
這可能嗎?這聽起來很簡單,但我花了幾個小時看,沒有任何工作。 (我不是這方面的專家。)有沒有更好的方法來做到這一點?
任何幫助非常感謝。
重複的http://stackoverflow.com/questions/13893256/jumping-to-anchor-in-iframe? – mplungjan