現狀:跳到IFRAME錨
第一:IFRAME ID爲miframe,顯示與錨網站叫素貞,即
<div id="suchen"></div>.
二。父框架。
目標:使父框架內的鏈接看起來像
<a class="LINK0" title="" href="javascript:springen('suchen');">w/e</a>
使在IFRAME內容滾動到錨俗塵。我的方法。
function springen(anker) {
var childWindow = document.getElementById("miframe").contentWindow;
// this should emulate a click on the ptAnchor DIV's child A HREF.
//childWindow.document.getElementById(anker).firstChild.click();
//childWindow.document.getElementById(anker).scrollIntoView();
// alternatively, this will simply scroll the child window to the top-left corner
//childWindow.scrollTo(0,200);
}
childWindow.scrollTo(0,200);
作品到目前爲止,滾動發生在200 但我需要滾動到非常主播,無論它是在IFRAME。想法?
沒有嘗試...但我在想,你應該通過它的所有'offsetParent's環和總結自己的'offsetTop's。 –
沒有工作.... –