情况:
首先:使用id miframe的iframe,显示一个名为suchen的锚点,即
<div id="suchen"></div>.
Run Code Online (Sandbox Code Playgroud)
第二.父框架.
目标:在父框架内建立一个类似的链接
<a class="LINK0" title="" href="javascript:springen('suchen');">w/e</a>
Run Code Online (Sandbox Code Playgroud)
使在内容的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);
}
Run Code Online (Sandbox Code Playgroud)
childWindow.scrollTo(0,200);到目前为止工作,滚动发生在200.但我需要滚动到非常锚,无论它在iframe中.想法?